Do not push a new task on database operational error without channel

If a task is pushed again, this creates an infinite loop because the task is
appended to the transaction tasks list and so it is run again in the same
request.

issue10421
review346251002
This commit is contained in:
Cédric Krier committed 2021-05-21 00:27:55 +02:00
1 parent 0120f274f2
commit 78bc172584
1 file changed
+3
+3
View File
@@ -128,6 +128,9 @@ def run_task(pool, task_id):
time.sleep(0.02 * retry)
try:
with Transaction().start(pool.database_name, 0) as transaction:
if not transaction.database.has_channel():
logger.critical('%s failed', name, exc_info=True)
return
task = Queue(task_id)
scheduled_at = dt.datetime.now()
scheduled_at += dt.timedelta(