@@ -510,16 +510,28 @@ def client_unblock(self, client_id, error=False, **kwargs):
510
510
args .append (b"ERROR" )
511
511
return self .execute_command (* args , ** kwargs )
512
512
513
- def client_pause (self , timeout , ** kwargs ):
513
+ def client_pause (self , timeout , all = True , ** kwargs ):
514
514
"""
515
515
Suspend all the Redis clients for the specified amount of time
516
516
:param timeout: milliseconds to pause clients
517
517
518
518
For more information check https://redis.io/commands/client-pause
519
- """
519
+ :param all: If true (default) all client commands are blocked.
520
+ otherwise, clients are only blocked if they attempt to execute
521
+ a write command.
522
+ For the WRITE mode, some commands have special behavior:
523
+ EVAL/EVALSHA: Will block client for all scripts.
524
+ PUBLISH: Will block client.
525
+ PFCOUNT: Will block client.
526
+ WAIT: Acknowledgments will be delayed, so this command will
527
+ appear blocked.
528
+ """
529
+ args = ["CLIENT PAUSE" , str (timeout )]
520
530
if not isinstance (timeout , int ):
521
531
raise DataError ("CLIENT PAUSE timeout must be an integer" )
522
- return self .execute_command ("CLIENT PAUSE" , str (timeout ), ** kwargs )
532
+ if not all :
533
+ args .append ("WRITE" )
534
+ return self .execute_command (* args , ** kwargs )
523
535
524
536
def client_unpause (self , ** kwargs ):
525
537
"""
0 commit comments