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

Commit 2605ed0

Browse files
committed
Fix implementation of CLIENT SETNAME so that it is no longer blocked. 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
1 parent 76aa25f commit 2605ed0

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

docs/release-notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Release Notes
2828
* PubSub tests has been all been disabled
2929
* 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.
3030
* 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)
31+
* 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.
3132

3233

3334
2.0.0 (Aug 12, 2019)

rediscluster/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class RedisCluster(Redis):
101101
'ACL USERS',
102102
'ACL WHOAMI',
103103
'BITOP',
104-
'CLIENT SETNAME',
105104
'MOVE',
106105
'SCRIPT KILL',
107106
'SENTINEL GET-MASTER-ADDR-BY-NAME',
@@ -122,6 +121,7 @@ class RedisCluster(Redis):
122121
"CLIENT ID",
123122
"CLIENT KILL",
124123
"CLIENT LIST",
124+
"CLIENT SETNAME",
125125
"CLUSTER INFO",
126126
"CONFIG GET",
127127
"CONFIG RESETSTAT",
@@ -213,6 +213,7 @@ class RedisCluster(Redis):
213213
"CLIENT ID",
214214
"CLIENT KILL",
215215
"CLIENT LIST",
216+
"CLIENT SETNAME",
216217
"CLUSTER INFO",
217218
"CONFIG GET",
218219
"CONFIG RESETSTAT",

tests/test_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def test_client_getname(self, r):
295295
assert r.client_getname() is None
296296

297297
@skip_if_server_version_lt('2.6.9')
298-
@skip_for_no_cluster_impl()
298+
@pytest.mark.skip(reason="Cluster specific override")
299299
def test_client_setname(self, r):
300300
assert r.client_setname('redis_py_test')
301301
assert r.client_getname() == 'redis_py_test'

tests/test_commands_cluster.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ def test_client_unblock(self, r):
9292
def test_client_getname(self, r):
9393
assert get_main_cluster_node_data(r.client_getname()) is None
9494

95+
@skip_if_server_version_lt('2.6.9')
96+
def test_client_setname(self, r):
97+
assert r.client_setname('redis_py_test')
98+
assert get_main_cluster_node_data(r.client_getname()) == 'redis_py_test'
99+
95100
def test_config_get(self, r):
96101
data = get_main_cluster_node_data(r.config_get())
97102
assert 'maxmemory' in data

0 commit comments

Comments
 (0)