Skip to content

Commit

Permalink
DEV: Add eager loading for scheduled jobs (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorhq committed May 2, 2024
1 parent 9548e90 commit 3cb1666
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/my_plugin_module/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ class Engine < ::Rails::Engine
engine_name PLUGIN_NAME
isolate_namespace MyPluginModule
config.autoload_paths << File.join(config.root, "lib")
scheduled_job_dir = "#{config.root}/app/jobs/scheduled"
config.to_prepare do
Rails.autoloaders.main.eager_load_dir(scheduled_job_dir) if Dir.exist?(scheduled_job_dir)
end
end
end

0 comments on commit 3cb1666

Please sign in to comment.