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

[ActiveJob] Autoload adapters #16700

Merged
merged 1 commit into from
Aug 26, 2014
Merged

[ActiveJob] Autoload adapters #16700

merged 1 commit into from
Aug 26, 2014

Conversation

seuros
Copy link
Member

@seuros seuros commented Aug 26, 2014

That will fix a bug when a backend don't require the adapter first

fixes: sidekiq/sidekiq#1912

That will also autoload the TestAdapter when required instead of always requiring it. (WIP)

cc @mperham @dhh @rafaelfranca

@@ -17,7 +17,6 @@ def queue_adapter=(name_or_adapter)

private
def load_adapter(name)
require "active_job/queue_adapters/#{name}_adapter"
Copy link
Member

Choose a reason for hiding this comment

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

I believe we don't need to use autoload for this. It will be lazy loaded anyway.

@cristianbica
Copy link
Member

Autoloading it's nicer than require.
The sidekiq bug seems to be fixed by this but it shouldn't happen because sidekiq requires the rails app and should load config/environments/#{Rails.env}.

Edited: removed this nonsense "Also adapters can be added from gems without placing them in active_job/queue_adapters/."

@rafaelfranca
Copy link
Member

Autoloading it's nicer than require.

But it brings problem with threaded environments.

The sidekiq bug seems to be fixed by this but it shouldn't happen because sidekiq requires the rails app and should load config/environments/#{Rails.env}.

Yes @seuros already explained me at Campfire. Seems good 👍

rafaelfranca added a commit that referenced this pull request Aug 26, 2014
[ActiveJob] Autoload adapters
@rafaelfranca rafaelfranca merged commit 14e2bbf into rails:master Aug 26, 2014
@seuros seuros deleted the autoload branch January 13, 2016 09:53
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

Successfully merging this pull request may close these issues.

which is the best way to load job from external gem
3 participants