Repository navigation
Conversation
Unlike the native cron worker, which holds the cron row lock for the whole run, a cron run as a queue job is only locked while it is enqueued, and no_parallel_queue_job_run only skips a job when an identical one is pending. A run lasting longer than the cron interval, or a trigger committed mid-run with allow_commit, started a second job of the same cron in parallel. The job now holds the cron row lock while it runs. A concurrent job of the same cron gets LockNotAvailable, which queue_job turns into a postponed retry.
_notify_progress is a no-op without the progress record the native cron runner puts in context, so a batched cron run as a queue job processed a single batch per run and could not deactivate itself. The server action now runs with a progress record: the cron is triggered again while records remain, and deactivated when it asks so.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #959
A cron run as a queue job behaves differently from a cron run by the Odoo cron worker in two ways:
Never run the same cron twice in parallel
Unlike the native cron worker, which holds the cron row lock for the whole run, a cron run as a queue job is only locked while it is enqueued, and
no_parallel_queue_job_runonly skips a job when an identical one is pending. A run lasting longer than the cron interval, or a trigger committed mid-run withallow_commit, started a second job of the same cron in parallel.The job now holds the cron row lock while it runs. A concurrent job of the same cron gets
LockNotAvailable, which queue_job turns into a postponed retry.Support the cron progress API
_notify_progressis a no-op without the progress record the native cron runner puts in context, so a batched cron run as a queue job processed a single batch per run and could not deactivate itself.The server action now runs with a progress record: the cron is triggered again while records remain, and deactivated when it asks so.