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:
commit
9c139f82db
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user