lib/good_job/scheduler.rb in good_job-0.2.1 vs lib/good_job/scheduler.rb in good_job-0.2.2

- old
+ new

@@ -40,20 +40,27 @@ def execute end def shutdown(wait: true) - if @timer.running? - @timer.shutdown - @timer.wait_for_termination if wait - end + @_shutdown = true - if @pool.running? - @pool.shutdown - @pool.wait_for_termination if wait + ActiveSupport::Notifications.instrument("scheduler_start_shutdown.good_job", { wait: wait }) + ActiveSupport::Notifications.instrument("scheduler_shutdown.good_job", { wait: wait }) do + if @timer.running? + @timer.shutdown + @timer.wait_for_termination if wait + end + + if @pool.running? + @pool.shutdown + @pool.wait_for_termination if wait + end end + end - true + def shutdown? + @_shutdown end def create_thread future = Concurrent::Future.new(args: [ordered_query], executor: @pool) do |query| Rails.application.executor.wrap do