changeset 5fbd311edaec in trytond:5.8
details: https://hg.tryton.org/trytond?cmd=changeset&node=5fbd311edaec
description:
        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)
diffstat:

 trytond/ir/cron.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 308c8cc0a4b7 -r 5fbd311edaec trytond/ir/cron.py
--- a/trytond/ir/cron.py        Wed Sep 01 22:46:03 2021 +0200
+++ b/trytond/ir/cron.py        Fri Sep 10 19:08:38 2021 +0200
@@ -132,8 +132,6 @@
                         time.sleep(0.02 * (retry - count))
                     try:
                         cron.run_once()
-                        cron.next_call = cron.compute_next_call(now)
-                        cron.save()
                         transaction.commit()
                     except Exception as e:
                         transaction.rollback()
@@ -141,6 +139,9 @@
                                 and count):
                             continue
                         logger.error('Running cron %s', cron.id, exc_info=True)
+                    cron.next_call = cron.compute_next_call(now)
+                    cron.save()
+                    transaction.commit()
                     break
         while transaction.tasks:
             task_id = transaction.tasks.pop()

Reply via email to