Skip to content

Commit 67f7f6f

Browse files
byrootrosa
authored andcommitted
Stop checking for file updates in production
While upgrading the lobsters benchmark in yjit-bench I noticed 2.8% of the overall time spent in `Dir[]`, all coming from FileUpdateChecker, which shouldn't be a think in production. After tracking it down, it comes from mission-control. Profile: https://share.firefox.dev/4hBdygq Ref: Shopify/yjit-bench#358
1 parent ca09138 commit 67f7f6f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/mission_control/jobs/engine.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ class Engine < ::Rails::Engine
103103

104104
initializer "mission_control-jobs.importmap", after: "importmap" do |app|
105105
MissionControl::Jobs.importmap.draw(root.join("config/importmap.rb"))
106-
MissionControl::Jobs.importmap.cache_sweeper(watches: root.join("app/javascript"))
106+
if app.config.importmap.sweep_cache && app.config.reloading_enabled?
107+
MissionControl::Jobs.importmap.cache_sweeper(watches: root.join("app/javascript"))
107108

108-
ActiveSupport.on_load(:action_controller_base) do
109-
before_action { MissionControl::Jobs.importmap.cache_sweeper.execute_if_updated }
109+
ActiveSupport.on_load(:action_controller_base) do
110+
before_action { MissionControl::Jobs.importmap.cache_sweeper.execute_if_updated }
111+
end
110112
end
111113
end
112114
end

0 commit comments

Comments
 (0)