lib/good_job/adapter.rb in good_job-2.11.3 vs lib/good_job/adapter.rb in good_job-2.12.0

- old
+ new

@@ -25,11 +25,17 @@ # # @param max_threads [Integer, nil] sets the number of threads per scheduler to use when +execution_mode+ is set to +:async+. The +queues+ parameter can specify a number of threads for each group of queues which will override this value. You can also set this with the environment variable +GOOD_JOB_MAX_THREADS+. Defaults to +5+. # @param queues [String, nil] determines which queues to execute jobs from when +execution_mode+ is set to +:async+. See {file:README.md#optimize-queues-threads-and-processes} for more details on the format of this string. You can also set this with the environment variable +GOOD_JOB_QUEUES+. Defaults to +"*"+. # @param poll_interval [Integer, nil] sets the number of seconds between polls for jobs when +execution_mode+ is set to +:async+. You can also set this with the environment variable +GOOD_JOB_POLL_INTERVAL+. Defaults to +1+. # @param start_async_on_initialize [Boolean] whether to start the async scheduler when the adapter is initialized. - def initialize(execution_mode: nil, queues: nil, max_threads: nil, poll_interval: nil, start_async_on_initialize: GoodJob.async_ready?) + def initialize(execution_mode: nil, queues: nil, max_threads: nil, poll_interval: nil, start_async_on_initialize: nil) + if execution_mode || queues || max_threads || poll_interval || start_async_on_initialize + ActiveSupport::Deprecation.warn( + "The GoodJob::Adapter's initialization parameters have been deprecated and will be removed in GoodJob v3. These options should be configured through GoodJob global configuration instead." + ) + end + @configuration = GoodJob::Configuration.new( { execution_mode: execution_mode, queues: queues, max_threads: max_threads, @@ -37,10 +43,10 @@ } ) @configuration.validate! self.class.instances << self - start_async if start_async_on_initialize + start_async if start_async_on_initialize || GoodJob.async_ready? end # Enqueues the ActiveJob job to be performed. # For use by Rails; you should generally not call this directly. # @param active_job [ActiveJob::Base] the job to be enqueued from +#perform_later+