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
This commit is contained in:
Cédric Krier committed 2021-09-10 19:08:38 +02:00
1 parent 1e12ebe9f8
commit 6c9b04b59f
1 file changed
+3 -2
+3 -2
View File
@@ -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()