Permalink
Browse files

Merge pull request #33054 from jboler/master

Fix route eager loading
  • Loading branch information...
rafaelfranca committed Jul 3, 2018
2 parents eaef4b6 + 869ba3e commit cfc48d0b5f363cc880237d2e25598c64c9eb8400
@@ -56,6 +56,7 @@ def ast
end
def simulator
return if ast.nil?
@simulator ||= begin
gtg = GTG::Builder.new(ast).transition_table
GTG::Simulator.new(gtg)
@@ -127,7 +127,7 @@ def self.complete(_state)
initializer :set_routes_reloader_hook do |app|
reloader = routes_reloader
reloader.eager_load = app.config.eager_load
reloader.execute_if_updated
reloader.execute
reloaders << reloader
app.reloader.to_run do
# We configure #execute rather than #execute_if_updated because if
@@ -7,7 +7,7 @@ class Application
class RoutesReloader
attr_reader :route_sets, :paths
attr_accessor :eager_load
delegate :updated?, to: :updater
delegate :execute_if_updated, :execute, :updated?, to: :updater
def initialize
@paths = []
@@ -19,31 +19,15 @@ def reload!
clear!
load_paths
finalize!
route_sets.each(&:eager_load!) if eager_load
ensure
revert
end
def execute
ret = updater.execute
route_sets.each(&:eager_load!) if eager_load
ret
end
def execute_if_updated
if updated = updater.execute_if_updated
route_sets.each(&:eager_load!) if eager_load
end
updated
end
private
def updater
@updater ||= begin
updater = ActiveSupport::FileUpdateChecker.new(paths) { reload! }
updater.execute
updater
end
@updater ||= ActiveSupport::FileUpdateChecker.new(paths) { reload! }
end
def clear!

0 comments on commit cfc48d0

Please sign in to comment.