diff options
author | Itamar Haber <itamar@redislabs.com> | 2018-10-05 15:46:05 +0300 |
---|---|---|
committer | Itamar Haber <itamar@redislabs.com> | 2018-10-05 15:46:05 +0300 |
commit | 80beebbd22a9a12da5347acbd6184f2e722ab8fa (patch) | |
tree | a79bf06dcb58f99086601ff8d3f8953a0d842d14 | |
parent | 4cb632a92581002f784e546e5393efa72853112c (diff) | |
download | redis-py-80beebbd22a9a12da5347acbd6184f2e722ab8fa.tar.gz |
Adds CLIENT UNBLOCK
Signed-off-by: Itamar Haber <itamar@redislabs.com>
-rwxr-xr-x | redis/client.py | 5 | ||||
-rw-r--r-- | tests/test_commands.py | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py index 53b7cc2..2ea28c3 100755 --- a/redis/client.py +++ b/redis/client.py @@ -402,6 +402,7 @@ class StrictRedis(object): 'CLIENT KILL': bool_ok, 'CLIENT LIST': parse_client_list, 'CLIENT SETNAME': bool_ok, + 'CLIENT UNBLOCK': int, 'CONFIG GET': parse_config_get, 'CONFIG RESETSTAT': bool_ok, 'CONFIG SET': bool_ok, @@ -716,6 +717,10 @@ class StrictRedis(object): "Sets the current connection name" return self.execute_command('CLIENT SETNAME', name) + def client_unblock(self, client_id): + "Unblocks a connection by its client id" + return self.execute_command('CLIENT UNBLOCK', client_id) + def config_get(self, pattern="*"): "Return a dictionary of configuration based on the ``pattern``" return self.execute_command('CONFIG GET', pattern) diff --git a/tests/test_commands.py b/tests/test_commands.py index b8deee6..01dbd79 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -63,6 +63,11 @@ class TestRedisCommands(object): def test_client_id(self, r): assert r.client_id() > 0 + @skip_if_server_version_lt('5.0.0') + def test_client_unblock(self, r): + myid = r.client_id() + assert r.client_unblock(myid) == 0 + @skip_if_server_version_lt('2.6.9') def test_client_getname(self, r): assert r.client_getname() is None |