From 6c9b04b59fedc476cfcc205887e01ef7acc0e7df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 10 Sep 2021 19:08:38 +0200 Subject: [PATCH] Do not retry failing cron task directly The next call datetime is set even if the task is failing. This way it will be retried based on the configured frequency. issue10695 review358751002 --- trytond/ir/cron.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trytond/ir/cron.py b/trytond/ir/cron.py index 60aa64adc6..f11c0a24f1 100644 --- a/trytond/ir/cron.py +++ b/trytond/ir/cron.py @@ -162,8 +162,6 @@ class Cron(DeactivableMixin, ModelSQL, ModelView): try: with processing(name): cron.run_once() - cron.next_call = cron.compute_next_call(now) - cron.save() transaction.commit() except Exception as e: transaction.rollback() @@ -171,6 +169,9 @@ class Cron(DeactivableMixin, ModelSQL, ModelView): and count): continue logger.error('%s failed', name, exc_info=True) + cron.next_call = cron.compute_next_call(now) + cron.save() + transaction.commit() break while transaction.tasks: task_id = transaction.tasks.pop()