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
This commit is contained in:
Cédric Krier committed 2021-09-10 19:08:38 +02:00
1 parent 3f082a04af
commit 1ad8a88e3d
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()