Skip to content

Commit a1c3093

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

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

django_rq/tests/utils.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ 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)
109
connection_kwargs = connection.connection_pool.connection_kwargs
10+
1111
for i in range(0, 100):
1212
try:
1313
q = get_queue_by_index(i)
1414
except AttributeError:
1515
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
16+
if q.name == name:
17+
# assert that the connection is correct
18+
assert q.connection.connection_pool.connection_kwargs == connection_kwargs
19+
20+
return i
21+
22+
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)