Skip to content

[18.0][ADD] queue_job: per DB channel managers with UI configuration and hot reload - #962

Draft
guewen wants to merge 7 commits into
OCA:18.0from
guewen:18.0-queue-job-channel-config
Draft

[18.0][ADD] queue_job: per DB channel managers with UI configuration and hot reload#962
guewen wants to merge 7 commits into
OCA:18.0from
guewen:18.0-queue-job-channel-config

Conversation

@guewen

@guewen guewen commented Aug 18, 2026

Copy link
Copy Markdown
Member

Implements #765 (comment)

Introduction of new configuration parameters

With this in the config file, the job runner uses the static server-side configuration as before, with no hot-reload (single, shared channel manager):

[queue_job]
channels = root:10,root.p1:2

With this in the config file, the job runner uses the channels configured in the database (the job runner builds one channel manager per database):

[queue_job]
max_capacity = 10

When capacity or other options of a channel (or channels are created/deleted, paused) change, the channel manager for the concerned database is hot reloaded.

Capacity can be constrained by database:

[queue_job]
max_capacity = 10
db_max_capacity = 2

Or with patterns

[queue_job]
max_capacity = 10
db_max_capacity = prod_*:6,staging:3,*:1

When db_max_capacity is not configured, each database gets a max capacity of the global max_capacity.
When there is more jobs pending than max_capacity across the databases, a round-robin allows each database to enqueue jobs in turns.

The channels option for server-side configuration takes precedence over the new configuration.

What does this bring?

Using this, I can, for instance

  • Pause and resume a channel
  • Create a new channel, assign a job function this channel, set a capacity at 1 (or anything) or sequential, all from the UI and applied live by the job runner for a single database

Migration path

Since the server-side configuration (ODOO_QUEUE_JOB_CHANNELS or channels in config file) is used by default, updating the addon has no effect. It allows to configure the channels capacity and other options on the UI / by script of the databases, then the server-side configuration can be replaced by the parameters max_capacity and db_max_capacity (or their environment variables counterparts).

Caveat

When using per DB channel managers, we cannot have a shared channel for several databases since each database has its own channels (use case mentioned in #765 (comment)). It could be possible to implement it using a single channel manager that coexists with the db channel managers, yet to define the specifics, e.g. use another root (shared:3, shared.foo:2) or a new option shared_channels = root.shared where the subchannels defined in this option are excluded from the DB channels.
In the meantime, using the server-side channels instead of per-db channels is a trade-off to accept if this use case is essential for a server.

@OCA-git-bot OCA-git-bot added the mod:queue_job Module queue_job label Aug 18, 2026
@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

Not used at this point by the jobrunner, but the changes on channels
trigger a notify to the jobrunner.
@guewen
guewen force-pushed the 18.0-queue-job-channel-config branch 3 times, most recently from 688eee4 to 9b9e3fd Compare August 18, 2026 10:35
@guewen
guewen force-pushed the 18.0-queue-job-channel-config branch from 9b9e3fd to 934ccb4 Compare August 18, 2026 12:02
@guewen guewen changed the title [18.0][ADD] queue_job: add jobrunner config on channels [18.0][ADD] queue_job: per DB channel managers with UI configuration and hot reload Aug 18, 2026
@guewen

guewen commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

Hi @sbidoul , can I have your thoughts on this, before I start completing the tests and docs?

@OCA-git-bot
OCA-git-bot deleted the branch OCA:18.0 August 27, 2026 14:44
@guewen guewen reopened this Aug 27, 2026
@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

@guewen
guewen changed the base branch from 18.0-queue-job-pause to 18.0 August 27, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:queue_job Module queue_job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants