-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for custom connection pool class in NodesManager (#2547)
Co-authored-by: zach.lee <[email protected]>
- Loading branch information
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
get_node_name, | ||
) | ||
from redis.commands import CommandsParser | ||
from redis.connection import Connection | ||
from redis.connection import BlockingConnectionPool, Connection, ConnectionPool | ||
from redis.crc import key_slot | ||
from redis.exceptions import ( | ||
AskError, | ||
|
@@ -2496,6 +2496,21 @@ def test_init_slots_dynamic_startup_nodes(self, dynamic_startup_nodes): | |
else: | ||
assert startup_nodes == ["[email protected]:7000"] | ||
|
||
@pytest.mark.parametrize( | ||
"connection_pool_class", [ConnectionPool, BlockingConnectionPool] | ||
) | ||
def test_connection_pool_class(self, connection_pool_class): | ||
rc = get_mocked_redis_client( | ||
url="redis://[email protected]:7000", | ||
cluster_slots=default_cluster_slots, | ||
connection_pool_class=connection_pool_class, | ||
) | ||
|
||
for node in rc.nodes_manager.nodes_cache.values(): | ||
assert isinstance( | ||
node.redis_connection.connection_pool, connection_pool_class | ||
) | ||
|
||
|
||
@pytest.mark.onlycluster | ||
class TestClusterPubSubObject: | ||
|