Skip to content

Support the customization of the timeout parameter when using a blocking connection pool with a redis cluster #3724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions redis/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def parse_cluster_myshardid(resp, **options):
"redis_connect_func",
"password",
"port",
"timeout",
"queue_class",
"retry",
"retry_on_timeout",
Expand Down
11 changes: 11 additions & 0 deletions tests/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,17 @@ def on_connect(connection):
_get_client(RedisCluster, request, redis_connect_func=mock)
assert mock.called is True

def test_user_connection_pool_timeout(self, request):
"""
Test support in passing timeout value by the user when setting
up a RedisCluster with a BlockingConnectionPool
"""

timeout = 3
client = _get_client(RedisCluster, request, timeout=timeout, connection_pool_class=redis.BlockingConnectionPool)
for _, node_config in client.nodes_manager.startup_nodes.items():
assert node_config.redis_connection.connection_pool.timeout == timeout

def test_set_default_node_success(self, r):
"""
test successful replacement of the default cluster node
Expand Down