Skip to content

Commit d63313b

Browse files
zakafzach-ieedvora-h
authored
add queue_class to REDIS_ALLOWED_KEYS (#2577)
* add queue_class to REDIS_ALLOWED_KEYS * fix lint * fix lint --------- Co-authored-by: zach.lee <zach.lee@sendbird.com> Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
1 parent c61eeb2 commit d63313b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

redis/cluster.py

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def parse_cluster_shards(resp, **options):
135135
"redis_connect_func",
136136
"password",
137137
"port",
138+
"queue_class",
138139
"retry",
139140
"retry_on_timeout",
140141
"socket_connect_timeout",

tests/test_cluster.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import binascii
22
import datetime
33
import warnings
4+
from queue import LifoQueue, Queue
45
from time import sleep
56
from unittest.mock import DEFAULT, Mock, call, patch
67

@@ -2511,6 +2512,18 @@ def test_connection_pool_class(self, connection_pool_class):
25112512
node.redis_connection.connection_pool, connection_pool_class
25122513
)
25132514

2515+
@pytest.mark.parametrize("queue_class", [Queue, LifoQueue])
2516+
def test_allow_custom_queue_class(self, queue_class):
2517+
rc = get_mocked_redis_client(
2518+
url="redis://my@DNS.com:7000",
2519+
cluster_slots=default_cluster_slots,
2520+
connection_pool_class=BlockingConnectionPool,
2521+
queue_class=queue_class,
2522+
)
2523+
2524+
for node in rc.nodes_manager.nodes_cache.values():
2525+
assert node.redis_connection.connection_pool.queue_class == queue_class
2526+
25142527

25152528
@pytest.mark.onlycluster
25162529
class TestClusterPubSubObject:

0 commit comments

Comments
 (0)