diff options
Diffstat (limited to 'redis/commands/core.py')
-rw-r--r-- | redis/commands/core.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py index 835ea61..6a8cd15 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -510,16 +510,28 @@ class ManagementCommands: args.append(b"ERROR") return self.execute_command(*args, **kwargs) - def client_pause(self, timeout, **kwargs): + def client_pause(self, timeout, all=True, **kwargs): """ Suspend all the Redis clients for the specified amount of time :param timeout: milliseconds to pause clients For more information check https://redis.io/commands/client-pause - """ + :param all: If true (default) all client commands are blocked. + otherwise, clients are only blocked if they attempt to execute + a write command. + For the WRITE mode, some commands have special behavior: + EVAL/EVALSHA: Will block client for all scripts. + PUBLISH: Will block client. + PFCOUNT: Will block client. + WAIT: Acknowledgments will be delayed, so this command will + appear blocked. + """ + args = ["CLIENT PAUSE", str(timeout)] if not isinstance(timeout, int): raise DataError("CLIENT PAUSE timeout must be an integer") - return self.execute_command("CLIENT PAUSE", str(timeout), **kwargs) + if not all: + args.append("WRITE") + return self.execute_command(*args, **kwargs) def client_unpause(self, **kwargs): """ |