MCPcopy
hub / github.com/rq/django-rq / get_queue_index

Function get_queue_index

tests/utils.py:26–56  ·  view source on GitHub ↗

Returns the position of Queue for the named queue in QUEUES_LIST

(name='default')

Source from the content-addressed store, hash-verified

24
25
26def get_queue_index(name='default'):
27 """
28 Returns the position of Queue for the named queue in QUEUES_LIST
29 """
30 connection = get_connection(name)
31 connection_kwargs = connection.connection_pool.connection_kwargs
32
33 for i in range(0, 100):
34 try:
35 q = get_queue_by_index(i)
36 except AttributeError:
37 continue
38 if q.name == name:
39 # assert that the connection is correct
40 pool_kwargs = q.connection.connection_pool.connection_kwargs
41 if not _is_buggy_retry(pool_kwargs) or not _is_buggy_retry(connection_kwargs):
42 assert pool_kwargs == connection_kwargs
43 else:
44 # patch the retry backoff since there is a bug in the default
45 # backoff strategy
46 #
47 # fixed in https://github.com/redis/redis-py/pull/3668
48 with patch.object(pool_kwargs['retry'], '_backoff', NoBackoff()):
49 with patch.object(connection_kwargs['retry'], '_backoff', NoBackoff()):
50 assert pool_kwargs == connection_kwargs
51
52 assert pool_kwargs['retry']._backoff.__dict__ == connection_kwargs['retry']._backoff.__dict__
53
54 return i
55
56 return None
57
58
59def flush_registry(registry):

Callers 15

test_queue_jobs_urlMethod · 0.85
test_workers_urlMethod · 0.85
test_job_detail_urlMethod · 0.85
test_failed_jobs_urlMethod · 0.85
test_jobsMethod · 0.85
test_job_detailsMethod · 0.85
test_result_detailsMethod · 0.85

Calls 3

get_queue_by_indexFunction · 0.90
get_connectionFunction · 0.85
_is_buggy_retryFunction · 0.85

Tested by 15

test_queue_jobs_urlMethod · 0.68
test_workers_urlMethod · 0.68
test_job_detail_urlMethod · 0.68
test_failed_jobs_urlMethod · 0.68
test_jobsMethod · 0.68
test_job_detailsMethod · 0.68
test_result_detailsMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…