Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
Fix implementation of CLIENT SETNAME so that it is no longer blocked.…
Browse files Browse the repository at this point in the history
… Also added note about how to set the connection name by default on all connections newly created. See issue 802 in redis-py. Fixes #327
  • Loading branch information
Grokzen committed May 22, 2020
1 parent 76aa25f commit 2605ed0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Release Notes
* PubSub tests has been all been disabled
* New feature, host_port_remap. Send in a remapping configuration to RedisCluster instance where the nodes configuration recieved from the redis cluster can be altered to allow for connection in certain circumstances. See new section in clients.rst in docs/ for usage example.
* When a slot is not covered by the cluster, it will not raise SlotNotCoveredError instead of the old generic RedisClusterException. The client will not attempt to rebuild the cluster layout a few times before giving up and raising that exception to the user. (#350)
* CLIENT SETNAME is now possible to use from the client instance. For setting the name for all connections from the client by default, see issue #802 in redis-py repo for the change that was implemented in redis-py 3.4.0.


2.0.0 (Aug 12, 2019)
Expand Down
3 changes: 2 additions & 1 deletion rediscluster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class RedisCluster(Redis):
'ACL USERS',
'ACL WHOAMI',
'BITOP',
'CLIENT SETNAME',
'MOVE',
'SCRIPT KILL',
'SENTINEL GET-MASTER-ADDR-BY-NAME',
Expand All @@ -122,6 +121,7 @@ class RedisCluster(Redis):
"CLIENT ID",
"CLIENT KILL",
"CLIENT LIST",
"CLIENT SETNAME",
"CLUSTER INFO",
"CONFIG GET",
"CONFIG RESETSTAT",
Expand Down Expand Up @@ -213,6 +213,7 @@ class RedisCluster(Redis):
"CLIENT ID",
"CLIENT KILL",
"CLIENT LIST",
"CLIENT SETNAME",
"CLUSTER INFO",
"CONFIG GET",
"CONFIG RESETSTAT",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def test_client_getname(self, r):
assert r.client_getname() is None

@skip_if_server_version_lt('2.6.9')
@skip_for_no_cluster_impl()
@pytest.mark.skip(reason="Cluster specific override")
def test_client_setname(self, r):
assert r.client_setname('redis_py_test')
assert r.client_getname() == 'redis_py_test'
Expand Down
5 changes: 5 additions & 0 deletions tests/test_commands_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ def test_client_unblock(self, r):
def test_client_getname(self, r):
assert get_main_cluster_node_data(r.client_getname()) is None

@skip_if_server_version_lt('2.6.9')
def test_client_setname(self, r):
assert r.client_setname('redis_py_test')
assert get_main_cluster_node_data(r.client_getname()) == 'redis_py_test'

def test_config_get(self, r):
data = get_main_cluster_node_data(r.config_get())
assert 'maxmemory' in data
Expand Down

0 comments on commit 2605ed0

Please sign in to comment.