From 78bc172584efa4f53571e5bb5399274cbdb57d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 21 May 2021 00:27:55 +0200 Subject: [PATCH] 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 --- trytond/worker.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/trytond/worker.py b/trytond/worker.py index 70f4ba4538..154e5b2669 100644 --- a/trytond/worker.py +++ b/trytond/worker.py @@ -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(