From 31514c31c940cd9041900667ae06b9e663860924 Mon Sep 17 00:00:00 2001 From: Dorin Hongu Date: Thu, 15 Oct 2026 09:18:25 +0300 Subject: [PATCH 1/2] [FIX] queue_job_cron_jobrunner: honour RetryableJobError seconds The cron runner always postponed a job raising RetryableJobError by 5 seconds, ignoring err.seconds and the retry pattern of the job function. Follow queue_job's controller: use err.seconds, then the retry pattern; keep 5 seconds when neither is set. Co-Authored-By: Claude Opus 5.5 --- queue_job_cron_jobrunner/README.rst | 25 ++++++++-- queue_job_cron_jobrunner/__manifest__.py | 2 +- queue_job_cron_jobrunner/models/queue_job.py | 12 ++++- queue_job_cron_jobrunner/readme/HISTORY.md | 8 +++ .../static/description/index.html | 49 ++++++++++++++----- .../tests/test_queue_job.py | 46 +++++++++++++++++ 6 files changed, 121 insertions(+), 21 deletions(-) create mode 100644 queue_job_cron_jobrunner/readme/HISTORY.md diff --git a/queue_job_cron_jobrunner/README.rst b/queue_job_cron_jobrunner/README.rst index 8615285dec..81d24f2d04 100644 --- a/queue_job_cron_jobrunner/README.rst +++ b/queue_job_cron_jobrunner/README.rst @@ -21,13 +21,13 @@ Queue Job Cron Jobrunner :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github - :target: https://github.com/OCA/queue/tree/18.0/queue_job_cron_jobrunner + :target: https://github.com/OCA/queue/tree/19.0/queue_job_cron_jobrunner :alt: OCA/queue .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job_cron_jobrunner + :target: https://translation.odoo-community.org/projects/queue-19-0/queue-19-0-queue_job_cron_jobrunner :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=18.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -96,13 +96,28 @@ Known issues / Roadmap - Commit transaction after job state updated to started. (See ``_process``) +Changelog +========= + +19.0.1.0.1 (2026-10-15) +----------------------- + +Bugfixes +~~~~~~~~ + +- A job raising ``RetryableJobError(seconds=N)`` is now postponed by + ``N`` seconds, and without ``seconds`` the retry pattern of the job + function applies, as with the standard job runner. Before, the cron + runner always postponed it by 5 seconds (still the delay when neither + is set). + Bug Tracker =========== Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -142,6 +157,6 @@ Current `maintainer `__: |maintainer-ivantodorovich| -This module is part of the `OCA/queue `_ project on GitHub. +This module is part of the `OCA/queue `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/queue_job_cron_jobrunner/__manifest__.py b/queue_job_cron_jobrunner/__manifest__.py index dad4881789..321f91cae8 100644 --- a/queue_job_cron_jobrunner/__manifest__.py +++ b/queue_job_cron_jobrunner/__manifest__.py @@ -1,7 +1,7 @@ { "name": "Queue Job Cron Jobrunner", "summary": "Run jobs without a dedicated JobRunner", - "version": "19.0.1.0.0", + "version": "19.0.1.0.1", "development_status": "Alpha", "author": "Camptocamp SA, Odoo Community Association (OCA)", "maintainers": ["ivantodorovich"], diff --git a/queue_job_cron_jobrunner/models/queue_job.py b/queue_job_cron_jobrunner/models/queue_job.py index 3213d28d0b..fc9095d10d 100644 --- a/queue_job_cron_jobrunner/models/queue_job.py +++ b/queue_job_cron_jobrunner/models/queue_job.py @@ -17,6 +17,9 @@ _logger = logging.getLogger(__name__) +# Delay of a RetryableJobError without seconds nor retry pattern +RETRY_SECONDS = 5 + class QueueJob(models.Model): _inherit = "queue.job" @@ -76,8 +79,13 @@ def _process(self, commit=False): _logger.debug("%s OperationalError, postponed", job) except RetryableJobError as err: - # delay the job later, requeue - job.postpone(result=str(err), seconds=5) + # delay the job later, requeue: as in queue_job's controller, honour + # the seconds of the exception, then the retry pattern of the job + # function; without both, keep the short delay of the cron runner + seconds = err.seconds + if not seconds and not job.job_config.retry_pattern: + seconds = RETRY_SECONDS + job.postpone(result=str(err), seconds=seconds) job.set_pending(reset_retry=False) job.store() _logger.debug("%s postponed", job) diff --git a/queue_job_cron_jobrunner/readme/HISTORY.md b/queue_job_cron_jobrunner/readme/HISTORY.md new file mode 100644 index 0000000000..0ae1071fad --- /dev/null +++ b/queue_job_cron_jobrunner/readme/HISTORY.md @@ -0,0 +1,8 @@ +## 19.0.1.0.1 (2026-10-15) + +### Bugfixes + +- A job raising `RetryableJobError(seconds=N)` is now postponed by `N` + seconds, and without `seconds` the retry pattern of the job function + applies, as with the standard job runner. Before, the cron runner always + postponed it by 5 seconds (still the delay when neither is set). diff --git a/queue_job_cron_jobrunner/static/description/index.html b/queue_job_cron_jobrunner/static/description/index.html index 9efaba8690..6ec639669a 100644 --- a/queue_job_cron_jobrunner/static/description/index.html +++ b/queue_job_cron_jobrunner/static/description/index.html @@ -374,7 +374,7 @@

Queue Job Cron Jobrunner

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:3c8052bb9647ac1c2222b7bbe43133884ab314534ef09686a3aef58e6b38f712 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Alpha License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

+

Alpha License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

This module implements a simple queue.job runner using ir.cron triggers.

It’s meant to be used on environments where the regular job runner can’t @@ -401,11 +401,18 @@

Queue Job Cron Jobrunner

+
+

Changelog

+
+

19.0.1.0.1 (2026-10-15)

+
+

Bugfixes

+
    +
  • A job raising RetryableJobError(seconds=N) is now postponed by +N seconds, and without seconds the retry pattern of the job +function applies, as with the standard job runner. Before, the cron +runner always postponed it by 5 seconds (still the delay when neither +is set).
  • +
+
+
+
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Camptocamp SA
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -480,7 +503,7 @@

Maintainers

promote its widespread use.

Current maintainer:

ivantodorovich

-

This module is part of the OCA/queue project on GitHub.

+

This module is part of the OCA/queue project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/queue_job_cron_jobrunner/tests/test_queue_job.py b/queue_job_cron_jobrunner/tests/test_queue_job.py index 54800b792c..45b7ee31d4 100644 --- a/queue_job_cron_jobrunner/tests/test_queue_job.py +++ b/queue_job_cron_jobrunner/tests/test_queue_job.py @@ -3,6 +3,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from datetime import timedelta +from unittest.mock import patch from freezegun import freeze_time @@ -10,6 +11,8 @@ from odoo.tests.common import TransactionCase from odoo.tools import mute_logger +from odoo.addons.queue_job.exception import RetryableJobError + class TestQueueJob(TransactionCase): @classmethod @@ -97,3 +100,46 @@ def test_acquire_one_job_consume_the_oldest_first(self): self.env["res.partner"].with_delay(priority=30).create({"name": "test"}) self.assertEqual(self.env["queue.job"]._acquire_one_job(), job.db_record()) + + def _run_retryable_job(self, seconds=None, retry_pattern=None): + """Process a job raising RetryableJobError as the cron runner does""" + if retry_pattern: + self.env["queue.job.function"].create( + {"name": ".create", "retry_pattern": retry_pattern} + ) + job = self.env["res.partner"].with_delay().create({"name": "test"}) + job_record = job.db_record() + partner_model = type(self.env["res.partner"]) + + def create(self, vals_list): + raise RetryableJobError("Try again later", seconds=seconds) + + with ( + freeze_time("2022-02-22 22:22:22"), + patch.object(partner_model, "create", create), + ): + job_record._process(commit=False) + self.assertEqual(job_record.state, "pending") + self.assertEqual(job_record.retry, 1) + return job_record + + def test_queue_job_retryable_error_seconds(self): + """RetryableJobError(seconds=N) postpones the job by N seconds""" + job_record = self._run_retryable_job(seconds=120) + self.assertEqual( + job_record.eta, fields.Datetime.to_datetime("2022-02-22 22:24:22") + ) + + def test_queue_job_retryable_error_retry_pattern(self): + """Without seconds, the retry pattern of the job function applies""" + job_record = self._run_retryable_job(retry_pattern={1: 300}) + self.assertEqual( + job_record.eta, fields.Datetime.to_datetime("2022-02-22 22:27:22") + ) + + def test_queue_job_retryable_error_default(self): + """Without seconds or retry pattern, the job is postponed by 5 seconds""" + job_record = self._run_retryable_job() + self.assertEqual( + job_record.eta, fields.Datetime.to_datetime("2022-02-22 22:22:27") + ) From 3311beea184db49e0512f4f58b969827bcd42852 Mon Sep 17 00:00:00 2001 From: Dorin Hongu Date: Thu, 15 Oct 2026 09:18:25 +0300 Subject: [PATCH 2/2] [IMP] queue: pre-commit auto fixes after the 19.0 port queue_job_cron_jobrunner and queue_job_subscribe are installable on 19.0: drop them from the excluded addons and regenerate the README. Co-Authored-By: Claude Opus 5.5 --- .pre-commit-config.yaml | 2 -- queue_job_subscribe/README.rst | 22 +++++++------ .../static/description/index.html | 32 +++++++++++-------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4cefd00cac..d9df375fac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,8 +4,6 @@ exclude: | ^base_import_async/| ^queue_job_batch/| ^queue_job_cron/| - ^queue_job_cron_jobrunner/| - ^queue_job_subscribe/| ^test_queue_job_batch/| # END NOT INSTALLABLE ADDONS # Files and folders generated by bots, to avoid loops diff --git a/queue_job_subscribe/README.rst b/queue_job_subscribe/README.rst index 1d1aa653f6..7ae1f747ba 100644 --- a/queue_job_subscribe/README.rst +++ b/queue_job_subscribe/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + =================== Queue Job Subscribe =================== @@ -13,17 +17,17 @@ Queue Job Subscribe .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github - :target: https://github.com/OCA/queue/tree/18.0/queue_job_subscribe + :target: https://github.com/OCA/queue/tree/19.0/queue_job_subscribe :alt: OCA/queue .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job_subscribe + :target: https://translation.odoo-community.org/projects/queue-19-0/queue-19-0-queue_job_subscribe :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=18.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -53,7 +57,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -68,9 +72,9 @@ Authors Contributors ------------ -- Cédric Pigeon -- Stéphane Bidoul -- Tran Quoc Duong +- Cédric Pigeon +- Stéphane Bidoul +- Tran Quoc Duong Other credits ------------- @@ -91,6 +95,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/queue `_ project on GitHub. +This module is part of the `OCA/queue `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/queue_job_subscribe/static/description/index.html b/queue_job_subscribe/static/description/index.html index a68b9af873..7ae1be27b3 100644 --- a/queue_job_subscribe/static/description/index.html +++ b/queue_job_subscribe/static/description/index.html @@ -3,7 +3,7 @@ -Queue Job Subscribe +README.rst -
-

Queue Job Subscribe

+
+ + +Odoo Community Association + +
+

Queue Job Subscribe

-

Beta License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

This module allows users to be member of group Job Queue Manager without becoming follower of failed jobs. This can avoid for some users to receive a lot of emails in case of failing jobs.

@@ -388,30 +393,30 @@

Queue Job Subscribe

-

Usage

+

Usage

On the user configuration form, there is new Job Notifications checkbox.

If checked, the user becomes follower of failed jobs if he/she is part of the Job Queue Manager group.

If not checked, the user does not become follower of failed jobs.

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Acsone SA/NV
-

Contributors

+

Contributors

-

Other credits

+

Other credits

The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp.

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -432,10 +437,11 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/queue project on GitHub.

+

This module is part of the OCA/queue project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+