Merge pull request #37898 from tgxworld/revert_evented_routes_reloader

Revert "Use `app.config.file_watcher` for watcher in `RoutesReloader`"
This commit is contained in:
Ryuta Kamizono 2019-12-06 16:10:42 +09:00 committed by GitHub
commit 9c139f82db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

@ -341,7 +341,7 @@ def require_environment! #:nodoc:
end
def routes_reloader #:nodoc:
@routes_reloader ||= RoutesReloader.new(file_watcher: config.file_watcher)
@routes_reloader ||= RoutesReloader.new
end
# Returns an array of file paths appended with a hash of

@ -9,11 +9,10 @@ class RoutesReloader
attr_accessor :eager_load
delegate :execute_if_updated, :execute, :updated?, to: :updater
def initialize(file_watcher: ActiveSupport::FileUpdateChecker)
def initialize
@paths = []
@route_sets = []
@eager_load = false
@file_watcher = file_watcher
end
def reload!
@ -27,7 +26,7 @@ def reload!
private
def updater
@updater ||= @file_watcher.new(paths) { reload! }
@updater ||= ActiveSupport::FileUpdateChecker.new(paths) { reload! }
end
def clear!

@ -184,8 +184,11 @@ def self.counter; 2; end
test "does not reload constants on development if custom file watcher always returns false" do
add_to_config <<-RUBY
config.cache_classes = false
config.file_watcher = Class.new(ActiveSupport::FileUpdateChecker) do
config.file_watcher = Class.new do
def initialize(*); end
def updated?; false; end
def execute; end
def execute_if_updated; false; end
end
RUBY