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

Configure GoodJob via Rails.application.config instead of recommending GoodJob::Adapter.new #199

Merged
merged 2 commits into from
Jan 18, 2021

Conversation

bensheldon
Copy link
Owner

@bensheldon bensheldon commented Jan 16, 2021

This is a moderately significant change in recommended configuration.

The problem is that calling GoodJob::Adapter.new within config/application.rb or config/environments/*.rb causes the Adapter to be instantiated too early in the Rails initialization process.

This addresses #195, #89.

This also contains changes to GoodJob::Performer, making it less generic and renaming it to GoodJob::JobPerformer. The intent is to to clearly delay references to GoodJob::Job. This is necessary because there is a circular dependency in Rails 6.1 when ActiveJob initializes GoodJob, which references ActiveRecord, which tries to initialize ActiveJob (for the destroy associations async feature).

README.md Outdated

# ...or all at once.
config.good_job = {
execution_mode = :async,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bensheldon this should probably be execution_mode: :async?

Thanks for Good Job, btw. It's doing a Great job so far. 💯

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching this! 🙌

…odJob::Job

Necessary because there is a circular dependency in Rails 6.1 when ActiveJob initializes GoodJob, which references ActiveRecord, which tries to initialize ActiveJob (for the destroy associations async feature)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants