Skip to content

Commit 1fc2df7

Browse files
committed
fix JSON stats view and tests with redis-py 6.0
x-ref: redis/redis-py#3622
1 parent aba2916 commit 1fc2df7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

django_rq/tests/utils.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ def get_queue_index(name='default'):
55
"""
66
Returns the position of Queue for the named queue in QUEUES_LIST
77
"""
8-
queue_index = None
98
connection = get_connection(name)
10-
connection_kwargs = connection.connection_pool.connection_kwargs
9+
1110
for i in range(0, 100):
1211
try:
1312
q = get_queue_by_index(i)
1413
except AttributeError:
1514
continue
16-
if q.name == name and q.connection.connection_pool.connection_kwargs == connection_kwargs:
17-
queue_index = i
18-
break
19-
return queue_index
15+
if q.name == name:
16+
# assert that the connection is correct
17+
assert q.connection.connection_pool.connection_kwargs == connection.connection_pool.connection_kwargs
18+
19+
return i
20+
21+
return None

django_rq/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ def get_statistics(run_maintenance_tasks=False):
6767
else:
6868
oldest_job_timestamp = "-"
6969

70-
# parse_class and connection_pool are not needed and not JSON serializable
71-
connection_kwargs.pop('parser_class', None)
70+
# remove unneeded properties which are not serializable in JSON
7271
connection_kwargs.pop('connection_pool', None)
72+
connection_kwargs.pop('parser_class', None)
73+
connection_kwargs.pop('retry', None)
7374

7475
queue_data = {
7576
'name': queue.name,

0 commit comments

Comments
 (0)