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

Minor Cron Concurrency Clarification #743

Closed
jonahgeorge opened this issue Nov 7, 2022 · 2 comments
Closed

Minor Cron Concurrency Clarification #743

jonahgeorge opened this issue Nov 7, 2022 · 2 comments

Comments

@jonahgeorge
Copy link
Sponsor

Based on #690, I'm under the impression it's entirely safe to run multiple workers with cron enabled. You would just suffer a slightly higher resource utilization. Is this actually the case?

If so, would you accept a minor README update to clarify this? I originally assumed this but doubted myself when I saw the snippet below without any other explanation:

# Enable cron in this process; e.g. only run on the first Heroku worker process
config.good_job.enable_cron = ENV['DYNO'] == 'worker.1' # or `true` or via $GOOD_JOB_ENABLE_CRON

Thanks a ton for your work on this project!

@bensheldon
Copy link
Owner

@jonahgeorge yep! it is safe to run multiple workers with cron enabled....by default, as long job records are preserved because a unique index is used on the cron key+time in the database and if the record is deleted and there is enough clock-drift another process could re-enqueue with the same key+time. But that is probably a rare risk.

That snippet could use some explanation, or you could remove it entirely.

@jonahgeorge
Copy link
Sponsor Author

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants