mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-08 08:28:12 +08:00
Handle Redis errors better
This commit is contained in:
+7
-1
@@ -294,7 +294,13 @@ def pusher(task_queue, e, list_key=Conf.Q_LIST, r=redis_client):
|
||||
"""
|
||||
logger.info(_('{} pushing tasks at {}').format(current_process().name, current_process().pid))
|
||||
while True:
|
||||
task = r.blpop(list_key, 1)
|
||||
try:
|
||||
task = r.blpop(list_key, 1)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
# redis probably crashed. Let the sentinel handle it.
|
||||
sleep(10)
|
||||
break
|
||||
if task:
|
||||
task = task[1]
|
||||
task_queue.put(task)
|
||||
|
||||
Reference in New Issue
Block a user