Skip to content

Commit

Permalink
add queue_class to REDIS_ALLOWED_KEYS (#2577)
Browse files Browse the repository at this point in the history
* add queue_class to REDIS_ALLOWED_KEYS

* fix lint

* fix lint

---------

Co-authored-by: zach.lee <[email protected]>
Co-authored-by: dvora-h <[email protected]>
  • Loading branch information
3 people authored Mar 16, 2023
1 parent c61eeb2 commit d63313b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions redis/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def parse_cluster_shards(resp, **options):
"redis_connect_func",
"password",
"port",
"queue_class",
"retry",
"retry_on_timeout",
"socket_connect_timeout",
Expand Down
13 changes: 13 additions & 0 deletions tests/test_cluster.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import binascii
import datetime
import warnings
from queue import LifoQueue, Queue
from time import sleep
from unittest.mock import DEFAULT, Mock, call, patch

Expand Down Expand Up @@ -2511,6 +2512,18 @@ def test_connection_pool_class(self, connection_pool_class):
node.redis_connection.connection_pool, connection_pool_class
)

@pytest.mark.parametrize("queue_class", [Queue, LifoQueue])
def test_allow_custom_queue_class(self, queue_class):
rc = get_mocked_redis_client(
url="redis://[email protected]:7000",
cluster_slots=default_cluster_slots,
connection_pool_class=BlockingConnectionPool,
queue_class=queue_class,
)

for node in rc.nodes_manager.nodes_cache.values():
assert node.redis_connection.connection_pool.queue_class == queue_class


@pytest.mark.onlycluster
class TestClusterPubSubObject:
Expand Down

0 comments on commit d63313b

Please sign in to comment.