From 5b1332bb4d3c3aa5215b43004d1e7f6a8d376dd0 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 11 Jan 2017 14:50:42 +0100 Subject: Fully initialize routes before the first request is handled `AD::Journey::GTG::Simulator` is lazily built the first time `Journey::Router#find_routes` is invoked, which happens when the first request is served. On large applications with many routes, building the simulator can take several hundred milliseconds (~700ms for us). Triggering this initialization during the boot process reduces the impact of deploys on the application response time. --- railties/lib/rails/application/finisher.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib/rails/application/finisher.rb') diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index a855e8fab0..c027d06663 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -124,6 +124,7 @@ module Rails # the hook are taken into account. initializer :set_routes_reloader_hook do |app| reloader = routes_reloader + reloader.eager_load = app.config.eager_load reloader.execute_if_updated reloaders << reloader app.reloader.to_run do -- cgit v1.2.3