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
Enable code reloading in development mode with Rails 5 #2457
Changes from 5 commits
51347c5
e9eb6a3
eca6424
df002c1
e4d0952
a67c9b1
fbb074f
19f57d9
d8bd483
5fd622e
871626c
86e03e9
0f166de
1ab8883
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,6 +231,10 @@ def boot_system | |
end | ||
require 'sidekiq/rails' | ||
require File.expand_path("#{options[:require]}/config/environment.rb") | ||
|
||
if ::Rails::VERSION::MAJOR > 4 && ::Rails.env.development? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this check if Rails.configuration.cache_classes is set to false instead of relying on a specific environment name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback! On Wed, Jun 15, 2016 at 4:15 PM, Edward Rudd notifications@github.com
|
||
Sidekiq.options[:reloader] = Sidekiq::Rails::Reloader.new | ||
end | ||
end | ||
options[:tag] ||= default_tag | ||
else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'pry' | ||
gem 'sidekiq', :path => '..' | ||
gem 'rails', '5.0.0.beta4' | ||
gem 'rack', '2.0.0.alpha' | ||
gem 'sinatra', github: 'sinatra/sinatra' | ||
|
||
platforms :ruby do | ||
gem 'sqlite3' | ||
gem 'redis-namespace' | ||
end | ||
|
||
platforms :jruby do | ||
gem 'jruby-openssl' | ||
gem 'activerecord-jdbcsqlite3-adapter' | ||
end | ||
#platforms :jruby do | ||
#gem 'jruby-openssl' | ||
#gem 'activerecord-jdbcsqlite3-adapter' | ||
#end | ||
|
||
gem 'rails' | ||
gem 'sidekiq', :path => '..' | ||
#gem 'ruby-prof' | ||
|
||
#de Does not work with jruby or rbx: | ||
#de gem 'pry-byebug' | ||
|
||
# sidekiq-web dependencies | ||
gem 'sinatra' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change obviates the above forced eager_load, along with the contortions it requires (for Rails 5.0+, of course).
(Or at least it would, if you still wrapped with the
@app.executor
whencache_classes
is true.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't have the context for your comment. Could you be more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The block of code just above here (231-235) exists to force eager loading, which (I assume) is because runtime autoloading and threaded workers didn't get along so well.
Autoloading is now threadsafe, as long as the relevant code is wrapped by
@app.executor
.@app.reloader
does that internally, but the condition below is skipping the reloader whencache_classes
is true.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated, see the commit I named you in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍