Skip to content

[19.0][MIG+FIX] queue_job_cron_jobrunner: migration + honour RetryableJobError seconds - #1023

Open
dhongu wants to merge 2 commits into
OCA:19.0from
dhongu:19.0-fix-cron-jobrunner-retryable
Open

dhongu wants to merge 2 commits into
OCA:19.0from
dhongu:19.0-fix-cron-jobrunner-retryable

Conversation

@dhongu

@dhongu dhongu commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

This PR has two commits:

If #876 gets merged first, I will rebase and drop the migration commit.

Problem

When a job raises RetryableJobError, the cron runner of queue_job_cron_jobrunner always postpones it by a hardcoded 5 seconds. It ignores both RetryableJobError(seconds=N) and the retry_pattern of the job function, while the standard job runner (queue_job controller, _try_perform_job) honours them. A job that asks to be retried in, say, 10 minutes (rate-limited API, lock held elsewhere) is retried every 5 seconds instead, burning its max_retries in under a minute.

Fix

Mirror the controller's behaviour:

  • RetryableJobError(seconds=N) → postpone by N seconds;
  • no seconds → seconds=None, so Job.postpone applies the job function's retry pattern;
  • neither set → keep the current 5 seconds delay (no behaviour change for existing setups).

Tests

Three new tests in tests/test_queue_job.py (explicit seconds, retry pattern, default). Without the fix, the first two fail; with it, all module tests pass on 19.0.

A towncrier fragment is included (readme/newsfragments/); no version bump, left to the bot.

Assisted-by: Claude Opus 5.5

@oca-cla-bot

oca-cla-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@dhongu
dhongu force-pushed the 19.0-fix-cron-jobrunner-retryable branch 2 times, most recently from 4398e68 to 103e1e0 Compare October 29, 2026 09:25
@OCA-git-bot OCA-git-bot added series:19.0 mod:queue_job_cron_jobrunner Module queue_job_cron_jobrunner labels Oct 29, 2026
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.

Assisted-by: Claude Opus 5.5
@dhongu
dhongu force-pushed the 19.0-fix-cron-jobrunner-retryable branch from 103e1e0 to 3572e10 Compare October 29, 2026 09:58
@dhongu dhongu changed the title [19.0][FIX] queue_job_cron_jobrunner: honour RetryableJobError seconds [19.0][MIG+FIX] queue_job_cron_jobrunner: migration + honour RetryableJobError seconds Oct 29, 2026
@dhongu

dhongu commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

@ivantodorovich (addon maintainer), @espo-tony, @yelizariev — since you approved / tested #876: this PR carries the same queue_job_cron_jobrunner 19.0 migration (with a CLA-signed commit, rebased on current 19.0) plus a small fix so the cron runner honours RetryableJobError(seconds=...) and the job function's retry pattern, with tests. CI is green.

Could you have a look and, if it's fine for you, approve? A merge by a maintainer would then unblock the addon on 19.0. Thanks!

Assisted-by: Claude Opus 5.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:queue_job_cron_jobrunner Module queue_job_cron_jobrunner series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants