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

Reload only on autoload path file changes #930

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stuwil
Copy link

@stuwil stuwil commented Jul 10, 2016

Splitting this from #929. This should close #776.

Currently, the app reloader is invoked constantly when Rails.application.config.cache_classes is false. Rails 3.2+ only reloads when files in the autoload path are changed, this implements the same behaviour.

@coveralls
Copy link

coveralls commented Jul 10, 2016

Coverage Status

Coverage remained the same at 91.127% when pulling d7fb073 on stuwil:reload-on-change into e3772d4 on collectiveidea:master.

@lleger
Copy link

lleger commented Jul 29, 2016

This PR fixed the issues I was having with DJ on Rails 5 👍

@coveralls
Copy link

coveralls commented Apr 10, 2017

Coverage Status

Coverage remained the same at 90.934% when pulling ab3e23f on stuwil:reload-on-change into bd07783 on collectiveidea:master.

@stwr667
Copy link

stwr667 commented Jul 17, 2018

This PR also fixes issues I've been having with Delayed Jobs on Rails 5.1 too. Thanks @stuwil.

@@ -116,7 +116,7 @@ def self.setup_lifecycle
end

def self.reload_app?
defined?(ActionDispatch::Reloader) && Rails.application.config.cache_classes == false
Rails.application.reloaders.any?(&:updated?) && Rails.application.config.cache_classes == false
Copy link

Choose a reason for hiding this comment

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

Given that the Rails.application.config.cache_classes == false check is constant (performance-wise) and Rails.application.reloaders.any?(&:updated?) is not, you should swap the order of these checks.

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.

Running out of memory due to code reloading feature in v4.0.6
4 participants