diff --git a/lib/good_job.rb b/lib/good_job.rb index c0389f7e8..1521f26bd 100644 --- a/lib/good_job.rb +++ b/lib/good_job.rb @@ -126,13 +126,13 @@ def self.restart(timeout: -1) _shutdown_all(_executables, :restart, timeout: timeout) end - # Sends +#shutdown+ or +#restart+ to executable objects ({GoodJob::Notifier}, {GoodJob::Poller}, {GoodJob::Scheduler}) - # @param executables [Array] Objects to shut down. + # Sends +#shutdown+ or +#restart+ to executable objects ({GoodJob::Notifier}, {GoodJob::Poller}, {GoodJob::Scheduler}, {GoodJob::MultiScheduler}, {GoodJob::CronManager}) + # @param executables [Array] Objects to shut down. # @param method_name [:symbol] Method to call, e.g. +:shutdown+ or +:restart+. # @param timeout [nil,Numeric] # @return [void] def self._shutdown_all(executables, method_name = :shutdown, timeout: -1) - if timeout.positive? + if timeout.is_a?(Numeric) && timeout.positive? executables.each { |executable| executable.send(method_name, timeout: nil) } stop_at = Time.current + timeout diff --git a/spec/lib/good_job/cron_manager_spec.rb b/spec/lib/good_job/cron_manager_spec.rb index dc6a3e602..5abb56361 100644 --- a/spec/lib/good_job/cron_manager_spec.rb +++ b/spec/lib/good_job/cron_manager_spec.rb @@ -44,7 +44,7 @@ cron_manager = described_class.new(schedules, start_on_initialize: true) wait_until(max: 5) do - expect(GoodJob::Job.count).to eq 3 + expect(GoodJob::Job.count).to be > 3 end good_job = GoodJob::Job.first