FEATURE: Add a config option that allows scheduling to be paused.

FEATURE: Add a config option that allows scheduling to be paused.

diff --git a/lib/generators/mini_scheduler/install/templates/mini_scheduler_initializer.rb b/lib/generators/mini_scheduler/install/templates/mini_scheduler_initializer.rb
index 10812aa..09ea03f 100644
--- a/lib/generators/mini_scheduler/install/templates/mini_scheduler_initializer.rb
+++ b/lib/generators/mini_scheduler/install/templates/mini_scheduler_initializer.rb
@@ -19,6 +19,14 @@ MiniScheduler.configure do |config|
   #   ...
   # end
 
+  # Before each tick, the configured block is run to check if the next job
+  # should be scheduled. The block should return a boolean where a return value
+  # of `True` skip scheduling.
+
+  # config.skip_schedule do
+  #   ...
+  # end
+
   # Add code that runs before processing requests to the
   # scheduler pages of the Sidekiq web UI.
 
diff --git a/lib/mini_scheduler.rb b/lib/mini_scheduler.rb
index c73eded..61494b0 100644
--- a/lib/mini_scheduler.rb
+++ b/lib/mini_scheduler.rb
@@ -47,22 +47,31 @@ module MiniScheduler
     @before_sidekiq_web_request
   end
 
+  def self.skip_schedule(&blk)
+    @skip_schedule = blk if blk
+    @skip_schedule
+  end
+
   def self.start
     manager = Manager.new
+
     Manager.discover_schedules.each do |schedule|
       manager.ensure_schedule!(schedule)
     end
+
     Thread.new do
       while true
         begin
-          manager.tick
+          if !self.skip_schedule || !self.skip_schedule.call
+            manager.tick
+          end
         rescue => e
           # the show must go on
           handle_job_exception(e, message: "While ticking scheduling manager")
         end
+
         sleep 1
       end
     end
   end
-
 end

GitHub sha: 9b4f42c0