diff --git a/lib/good_job.rb b/lib/good_job.rb index a4623d7eb..b698a4947 100644 --- a/lib/good_job.rb +++ b/lib/good_job.rb @@ -96,13 +96,13 @@ def self.reperform_jobs_on_standard_error=(value) # @param wait [Boolean] whether to wait for shutdown # @return [void] def self.shutdown(timeout: -1, wait: nil) - timeout = if wait.present? + timeout = if wait.nil? + timeout + else ActiveSupport::Deprecation.warn( "Using `GoodJob.shutdown` with `wait:` kwarg is deprecated; use `timeout:` kwarg instead e.g. GoodJob.shutdown(timeout: #{wait ? '-1' : 'nil'})" ) wait ? -1 : nil - else - timeout end executables = Array(Notifier.instances) + Array(Poller.instances) + Array(Scheduler.instances) diff --git a/lib/good_job/adapter.rb b/lib/good_job/adapter.rb index 90f0bcf6e..c87d822ea 100644 --- a/lib/good_job/adapter.rb +++ b/lib/good_job/adapter.rb @@ -105,13 +105,13 @@ def enqueue_at(active_job, timestamp) # @param wait [Boolean, nil] Deprecated. Use +timeout:+ instead. # @return [void] def shutdown(timeout: :default, wait: nil) - timeout = if wait.present? + timeout = if wait.nil? + timeout + else ActiveSupport::Deprecation.warn( "Using `GoodJob::Adapter.shutdown` with `wait:` kwarg is deprecated; use `timeout:` kwarg instead e.g. GoodJob::Adapter.shutdown(timeout: #{wait ? '-1' : 'nil'})" ) wait ? -1 : nil - else - timeout end timeout = if timeout == :default diff --git a/lib/good_job/configuration.rb b/lib/good_job/configuration.rb index f3ef2a2aa..2e0a48739 100644 --- a/lib/good_job/configuration.rb +++ b/lib/good_job/configuration.rb @@ -84,9 +84,9 @@ def max_threads # on the format of this string. # @return [String] def queue_string - options[:queues] || - rails_config[:queues] || - env['GOOD_JOB_QUEUES'] || + options[:queues].presence || + rails_config[:queues].presence || + env['GOOD_JOB_QUEUES'].presence || '*' end diff --git a/scripts/benchmark_scheduler.rb b/scripts/benchmark_scheduler.rb index 5b6bedfed..bc604c4f0 100644 --- a/scripts/benchmark_scheduler.rb +++ b/scripts/benchmark_scheduler.rb @@ -10,7 +10,7 @@ MAX_THREADS = 0 JOBS_SIZE = 20_000 -class Performer +class CustomPerformer < GoodJob::JobPerformer def name 'script' end @@ -28,7 +28,7 @@ def next_at(**_options) end end -scheduler = GoodJob::Scheduler.new(Performer.new, max_threads: MAX_THREADS, max_cache: MAX_CACHE) +scheduler = GoodJob::Scheduler.new(CustomPerformer.new("*"), max_threads: MAX_THREADS, max_cache: MAX_CACHE) report = MemoryProfiler.report do JOBS_SIZE.times { scheduler.create_thread({ scheduled_at: Time.current + 100_000 }) }