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

Cannot run db:migrate when execution mode is :async #229

Closed
Systho opened this issue Apr 5, 2021 · 4 comments
Closed

Cannot run db:migrate when execution mode is :async #229

Systho opened this issue Apr 5, 2021 · 4 comments
Projects

Comments

@Systho
Copy link

Systho commented Apr 5, 2021

Hello,

I'm using good_job in a team project and the gem was introduced in a PR along with a change in rails config :

  config.good_job.execution_mode = :async

This causes max_cache to be different than 0 and therefore it tries to warm_cache upon initialization.

The problem is that I do not have the good_jobs table yet and my rails db:migrate is supposed to create it but it crashes dues to warm_cache failing because the table does not exists.

@bensheldon bensheldon added this to Inbox in Backlog Apr 5, 2021
@bensheldon
Copy link
Owner

Thanks for opening an issue! That is not a good situation.

Could you give this configuration a try and let me know if it solves your problem?

if Rails.const_defined?("Server")
  config.good_job.execution_mode = :async
else
  config.good_job.execution_mode = :external
end

The intention is that it will only run GoodJob in async mode running the webserver, which should make any other commands, tasks or interactive console not run GoodJob in async mode.

@Systho
Copy link
Author

Systho commented Apr 6, 2021

The suggested workaround works, thanks for the suggestion !

But this should probably be done in a more natural way by the gem itself in a future version :)

@Systho
Copy link
Author

Systho commented Apr 6, 2021

It probably related to #194

@bensheldon
Copy link
Owner

Happy I could help unblock you 🙌

And I agree. Thanks for linking to #194, which is where I plan to improve this experience.

Backlog automation moved this from Inbox to Done Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Backlog
  
Done
Development

No branches or pull requests

2 participants