From 1ad8a88e3d50bef1a29ac511f93fb0e90e1e4a0f 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 (grafted from befd1119ab8d12bf79e2b439376940f251b03280) --HG-- branch : 6.0 --- 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()