-
Notifications
You must be signed in to change notification settings - Fork 331
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
Problems with class loading in Rails production (like) environments #15
Comments
Thanks! yes, this is a symptom of a threaded context in ruby. I myself often try to eager load things as much as possible. update: https://github.com/jondot/sneakers/wiki/Eager-loading |
To help other people find this, the full error message looks like this:
|
@abevoelker thanks!, I will also add your note to the Wiki page |
I'm curious why this isn't built into sneakers:run rake task provided by the sneakers gem? |
+1 for this being built into sneakers. It caused problems with our production. Could you reopen? |
@sheerun: probably easiest to re-open as a pull-request. Just a thought :) |
Where did you add this line of code? In your own Rake task executing the sneakers:run task or in Rakefile? I get "LoadError: No such file to load -- application_controller" all the time. |
I created a |
Me too. Had to let the task depend on environment to not get the LoadError though. Don't know if this is correct but I'll try it out anyway. task run2: :environment do
::Rails.application.eager_load!
Rake::Task['sneakers:run'].invoke
end |
Just in case anyone lands here and wonders if it was added to the default rake task, it was on 2015.04.01: 4f07a83 |
Hi,
there was a little issue with class loading (when processes/workers/threads are restarted i guess) that sometimes the workers did not load the rails environment properly.
Some errors like "circular dependency" or that methods on classes/objects are not found that should obviously be there.
It only happens in a environment where classes are cached (rails production or when otherwise activated).
The fix is to make sure the eager-loading the environment is manually triggered (which is deactivated by default for rake tasks).
Just add this line:
Before doing anything else in the sneakers:run rake task and it works fine (did so far here).
The text was updated successfully, but these errors were encountered: