From 1829beb1ec0c401e701474c7f63cabc164cd1931 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Mon, 4 Oct 2021 16:07:50 -0400 Subject: [PATCH] Add andymccurdy/redis-py@88e5bd8938006a6e7bcc626048a9cd4572bbac68 support for client unpause (andymccurdy/redis-py#1512) Signed-off-by: Andrew-Chen-Wang --- aioredis/client.py | 6 ++++++ tests/test_commands.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/aioredis/client.py b/aioredis/client.py index 7191f8ffd..e7e74a23c 100644 --- a/aioredis/client.py +++ b/aioredis/client.py @@ -1449,6 +1449,12 @@ def client_pause(self, timeout: int) -> Awaitable: raise DataError("CLIENT PAUSE timeout must be an integer") return self.execute_command("CLIENT PAUSE", str(timeout)) + def client_unpause(self) -> Awaitable: + """ + Unpause all redis clients + """ + return self.execute_command("CLIENT UNPAUSE") + def readwrite(self) -> Awaitable: """Disables read queries for a connection to a Redis Cluster slave node""" return self.execute_command("READWRITE") diff --git a/tests/test_commands.py b/tests/test_commands.py index ecd15eea7..d8cf185b9 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -481,6 +481,10 @@ async def test_client_pause(self, r: aioredis.Redis): with pytest.raises(exceptions.RedisError): await r.client_pause(timeout="not an integer") + @skip_if_server_version_lt("6.2.0") + async def test_client_unpause(self, r: aioredis.Redis): + assert await r.client_unpause() == b"OK" + async def test_config_get(self, r: aioredis.Redis): data = await r.config_get() assert "maxmemory" in data