From cb348ca880e38b262cbaeeb67ea0fcb4e5e3743b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 19 Feb 2023 20:58:01 +0100 Subject: [PATCH] Clear tasks when transaction is rollback The tasks records are removed on rollback so there is no need to try to run them. --- trytond/trytond/protocols/dispatcher.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trytond/trytond/protocols/dispatcher.py b/trytond/trytond/protocols/dispatcher.py index f5b0a5e20a..72c6eec5a9 100644 --- a/trytond/trytond/protocols/dispatcher.py +++ b/trytond/trytond/protocols/dispatcher.py @@ -212,11 +212,13 @@ def _dispatch(request, pool, *args, **kwargs): for i in inst] except TransactionError as e: transaction.rollback() + transaction.tasks.clear() e.fix(transaction_extras) continue except backend.DatabaseOperationalError: if count < retry and not rpc.readonly: transaction.rollback() + transaction.tasks.clear() count += 1 logger.debug("Retry: %i", count) continue