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

Pause jobs during migration / maintenance? #257

Closed
reczy opened this issue May 16, 2021 · 2 comments
Closed

Pause jobs during migration / maintenance? #257

reczy opened this issue May 16, 2021 · 2 comments

Comments

@reczy
Copy link
Contributor

reczy commented May 16, 2021

Is there (or could there be) a way to accomplish this globally via GoodJob? Historically, if not having running background jobs was a necessity, I'd put the website into maintenance mode and make sure all jobs finished. Is there a better way? Thanks!

@bensheldon
Copy link
Owner

My top-level recommendation would be to use StrongMigrations and backward-code-compatible migrations so that you don't have to stop jobs or webservers at all.

Otherwise, the safest option would be to turn off all job processes and put the website into maintenance mode as you described..

Experimentally, you could put the website into maintenance mode (to prevent new jobs from being created) and invoke a query to lock all of the jobs (e.g. GoodJob::Job.all.advisory_lock) and just hold that lock until you're finished. But I think that's very experimental.

@reczy
Copy link
Contributor Author

reczy commented May 25, 2021

Thanks for your response - the strong migrations gem is a good suggestion.

@reczy reczy closed this as completed May 25, 2021
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

2 participants