Skip to content

RFC: Jobrunner channels as cron jobs? #371

@thomaspaulb

Description

@thomaspaulb

The decision to write the jobrunner was made very early on. In my understanding, it was designed to allow fast parallel execution of background jobs in multiple channels, also allowing a hierarchy of channels.

However, I'm asking myself why not offer users the alternative to use ir.cron to run jobs. That would look as follows:

  • Each channel has a corresponding ir.cron record, disabled by default
  • These crons trigger periodically eg. every 1 minute or 5 minutes (configurable)
  • When triggered, the cron start a loop to processing jobs assigned to the channel, just like the jobrunner does. The loop can be configured to run a maximum of eg. 100 times or 1000 times (configurable) before it stops and waits to be triggered again. Of course, a database commit would run after each iteration.

What would be the benefits or problems with such an approach?

Benefits I can think of:

  • It would play well with odoo.sh
  • It's easier to configure eg. no server_wide_modules or special Odoo settings
  • It's less complex / easier to understand / debug
  • It's straightforward to enable or disable a channel
  • Channels could be created and removed dynamically

Downsides:

  • There will be periods of 'pause' when no jobs are run - between the end and the next trigger of a cron run
  • Hierarchy of channels / channel capacity could be more difficult to implement
  • max_cron_threads would have to be high enough, warn user if he exhausts them
  • ... probably some I havent thought of

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions