Repository navigation
[FIX] base_bg: run one job per cron run and isolate the user notification - #519
Closed
fw-bot-adhoc wants to merge 1 commit into
Closed
fw-bot-adhoc wants to merge 1 commit into
fw-bot-adhoc wants to merge 1 commit into
Conversation
Contributor
Contributor
Author
|
@rov-adhoc @maq-adhoc cherrypicking of pull request #494 failed. stdout: Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
run() committed the job work, its finish() and the user notification together. When the notification failed (e.g. a serialization failure on discuss_channel_member), the rollback discarded the work of a job that had already finished, and the retry ran it again. run() now commits the job work and finish() before notifying. The notification runs in a savepoint and an error there is only logged, so a finished job is not rolled back nor run again. The runner change of the original commit (one job per cron run) is not forward-ported: 19.0 already processes one job per run and re-triggers the runner while enqueued jobs remain. X-original-commit: b074ac1
rov-adhoc
force-pushed
the
19.0-18.0-t-79313-rov-11128-fw
branch
from
November 13, 2026 13:11
9bcc7ad to
e52b731
Compare
Contributor
|
@roboadhoc r+ nobump |
roboadhoc
pushed a commit
that referenced
this pull request
Nov 13, 2026
run() committed the job work, its finish() and the user notification together. When the notification failed (e.g. a serialization failure on discuss_channel_member), the rollback discarded the work of a job that had already finished, and the retry ran it again. run() now commits the job work and finish() before notifying. The notification runs in a savepoint and an error there is only logged, so a finished job is not rolled back nor run again. The runner change of the original commit (one job per cron run) is not forward-ported: 19.0 already processes one job per run and re-triggers the runner while enqueued jobs remain. closes #519 X-original-commit: b074ac1 Signed-off-by: Filoquin adhoc <[email protected]> Signed-off-by: rov-adhoc <[email protected]>
This branch was previously deployed
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.

Tarea: https://www.adhoc.inc/odoo/project.task/79313
Problem
limit_time_real_croncounts the whole cron run. In 18.0_cron_run_enqueued_jobs(limit=5)chains up to 5 jobs in one run, so with jobs of about 10 minutes each (large bank statement imports) the worker passes the limit and is killed with SIGKILL. The jobs start again from zero.Also,
finish()and_notify_user()share the same commit. When the notification fails withcould not serialize access due to concurrent updateonUPDATE discuss_channel_member, the rollback discards the work of a job that already finished, and the retry runs it again.Changes
_cron_run_enqueued_jobs: one job per run by default (limitis kept as a parameter). When enqueued jobs remain, the runner triggers itself again. This also covers a failed job that is enqueued again, which before waited for the 10 minute interval.run(): commits the job work andfinish()before notifying. The new_notify_resultposts the notification in a savepoint and only logs an error, so the job staysdoneand is not run again.Forward-port to 19.0
19.0 already runs one job per cron run, so the runner part and
test_cron_runs_one_job_per_run_and_retriggersdo not apply there and must be dropped. The notification fix does apply, adapted to the 19.0run()(it handles errors without raising and callsinvalidate_all()). That adaptation is ready and its test passes on 19.0 (59/59base_bgtests on a fresh database).Tests
test_run_notification_failure_keeps_job_donetest_cron_runs_one_job_per_run_and_retriggersThese 18.0 tests were not run locally (19.0 environment): runbot validates them.
Forward-Port-Of: #494