Skip to content

Commit 25c6d82

Browse files
committed
support the customization of the timeout parameter when using a blockig connection pool with a redis cluster
1 parent 67ab74d commit 25c6d82

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

redis/cluster.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def parse_cluster_myshardid(resp, **options):
170170
"redis_connect_func",
171171
"password",
172172
"port",
173+
"timeout",
173174
"queue_class",
174175
"retry",
175176
"retry_on_timeout",

tests/test_cluster.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,17 @@ def on_connect(connection):
783783
_get_client(RedisCluster, request, redis_connect_func=mock)
784784
assert mock.called is True
785785

786+
def test_user_connection_pool_timeout(self, request):
787+
"""
788+
Test support in passing timeout value by the user when setting
789+
up a RedisCluster with a BlockingConnectionPool
790+
"""
791+
792+
timeout = 3
793+
client = _get_client(RedisCluster, request, timeout=timeout, connection_pool_class=redis.BlockingConnectionPool)
794+
for _, node_config in client.nodes_manager.startup_nodes.items():
795+
assert node_config.redis_connection.connection_pool.timeout == timeout
796+
786797
def test_set_default_node_success(self, r):
787798
"""
788799
test successful replacement of the default cluster node

0 commit comments

Comments
 (0)