DEV: Only eagerload scheduled jobs in a Sidekiq process.

DEV: Only eagerload scheduled jobs in a Sidekiq process.

diff --git a/config/initializers/100-sidekiq.rb b/config/initializers/100-sidekiq.rb
index 6d6e0dd..dc488ec 100644
--- a/config/initializers/100-sidekiq.rb
+++ b/config/initializers/100-sidekiq.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 # Ensure that scheduled jobs are loaded before mini_scheduler is configured.
-if Rails.env == "development"
+if Rails.env == "development" && Sidekiq.server?
   require "jobs/base"
   Dir.glob("#{Rails.root}/app/jobs/scheduled/*.rb") do |f|
     load(f)

GitHub sha: 20bd6d97

@tgxworld What was the reason for this change? It prevents recurring jobs from showing up in /sidekiq/scheduler in development mode because MiniScheduler::Manager.discover_schedules is empty.

1 Like