Pause MiniScheduler when Sidekiq is paused.

Pause MiniScheduler when Sidekiq is paused.

diff --git a/Gemfile.lock b/Gemfile.lock
index 9a9da67..e30bbc0 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -202,7 +202,7 @@ GEM
     mini_portile2 (2.3.0)
     mini_racer (0.2.3)
       libv8 (>= 6.3)
-    mini_scheduler (0.8.1)
+    mini_scheduler (0.9.0)
     mini_sql (0.1.10)
     mini_suffix (0.3.0)
       ffi (~> 1.9)
diff --git a/config/initializers/100-sidekiq.rb b/config/initializers/100-sidekiq.rb
index efc76be..b25cb6d 100644
--- a/config/initializers/100-sidekiq.rb
+++ b/config/initializers/100-sidekiq.rb
@@ -24,8 +24,12 @@ MiniScheduler.configure do |config|
     DiscourseEvent.trigger(:scheduled_job_ran, stat)
   end
 
+  config.skip_schedule { Sidekiq.paused? }
+
   config.before_sidekiq_web_request do
-    RailsMultisite::ConnectionManagement.establish_connection(db: 'default')
+    RailsMultisite::ConnectionManagement.establish_connection(
+      db: RailsMultisite::ConnectionManagement::DEFAULT
+    )
   end
 
 end

GitHub sha: ee7ab3e2

2 Likes