Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Jobrunner channels as cron jobs? #371

Closed
thomaspaulb opened this issue Sep 7, 2021 · 3 comments
Closed

RFC: Jobrunner channels as cron jobs? #371

thomaspaulb opened this issue Sep 7, 2021 · 3 comments

Comments

@thomaspaulb
Copy link

thomaspaulb commented Sep 7, 2021

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
@yelizariev
Copy link
Member

There will be periods of 'pause' when no jobs are run - between the end and the next trigger of a cron run

It's not the case since Odoo 15: odoo/odoo@4b28f11

@simahawk
Copy link
Contributor

@guewen shall we close this?

@ivantodorovich
Copy link
Contributor

@sbidoul sbidoul closed this as completed Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants