@@ -510,16 +510,28 @@ def client_unblock(self, client_id, error=False, **kwargs):
510510 args .append (b"ERROR" )
511511 return self .execute_command (* args , ** kwargs )
512512
513- def client_pause (self , timeout , ** kwargs ):
513+ def client_pause (self , timeout , all = True , ** kwargs ):
514514 """
515515 Suspend all the Redis clients for the specified amount of time
516516 :param timeout: milliseconds to pause clients
517517
518518 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 )]
520530 if not isinstance (timeout , int ):
521531 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 )
523535
524536 def client_unpause (self , ** kwargs ):
525537 """
0 commit comments