Skip to content

[FIX] queue_job: don't start the jobrunner in odoo shell - #1003

Merged
OCA-git-bot merged 1 commit into
OCA:17.0from
ForgeFlow:17.0-fix-queue_job-shell-runner
Oct 8, 2026
Merged

OCA-git-bot merged 1 commit into
OCA:17.0from
ForgeFlow:17.0-fix-queue_job-shell-runner

Conversation

@GuillemCForgeFlow

Copy link
Copy Markdown
Contributor

With queue_job in server_wide_modules, every odoo shell starts the job runner thread, stops it right away and waits for it, so the prompt only comes after 5 seconds:

INFO ? odoo.addons.queue_job.jobrunner: starting jobrunner thread (in threaded server)
INFO ? odoo.addons.queue_job.jobrunner.channels: Configured channel: root(C:2,Q:0,R:0,F:0)
INFO ? odoo.addons.queue_job.jobrunner.runner: graceful stop requested
INFO ? odoo.service.server: Initiating shutdown
INFO ? odoo.service.server: Hit CTRL-C again or send a second signal to force the shutdown.
INFO ? odoo.addons.queue_job.jobrunner.runner: starting      <- 5 s later
INFO ? odoo.addons.queue_job.jobrunner.runner: stopped

Cause. odoo/cli/shell.py starts the server with odoo.service.server.start(preload=[], stop=True), and ThreadedServer.run() passes the flag on to ThreadedServer.start(stop=stop). Core uses it to skip its own background services: the HTTP thread is only spawned if config['http_enable'] and not stop, and run() returns before cron_spawn(). The patched start of queue_job ignores it and only checks config["stop_after_init"], which the shell does not set. The runner thread sleeps START_DELAY (5 s) before running, and threaded_stop() joins it.

Fix. threaded_start() starts the runner only when the server is not started with stop=True, as core does for its HTTP and cron threads. A normal server start is unchanged, and --stop-after-init was already skipped in _start_runner_thread().

cc @ForgeFlow

odoo shell starts the server with stop=True and stops it right away, so the
runner thread was started for nothing and its START_DELAY made every shell
wait 5 seconds before the prompt. Core already skips its HTTP and cron threads
when stop is set; the runner now follows the same rule.
@oca-cla-bot

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @guewen,
some modules you are maintaining are being modified, check this out!

@AaronHForgeFlow AaronHForgeFlow left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@GuillemCForgeFlow

Copy link
Copy Markdown
Contributor Author

@guewen can we merge this one? 🙂

@guewen

guewen commented Oct 8, 2026

Copy link
Copy Markdown
Member

/ocabot merge patch

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-1003-by-guewen-bump-patch, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit 6817439 into OCA:17.0 Oct 8, 2026
6 of 8 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 983b6ad. Thanks a lot for contributing to OCA. ❤️

@GuillemCForgeFlow

Copy link
Copy Markdown
Contributor Author

forward ports #1004 & #1005

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants