Clear tasks when transaction is rollback

The tasks records are removed on rollback so there is no need to try to run
them.
This commit is contained in:
Cédric Krier
2023-02-19 20:58:01 +01:00
parent 2695deb3c5
commit cb348ca880
+2
View File
@@ -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