diff --git a/README.md b/README.md index 324a178a8..6dbe6acf3 100644 --- a/README.md +++ b/README.md @@ -816,7 +816,7 @@ GoodJob.on_thread_error = -> (exception) { Rails.error.report(exception) } By default, GoodJob relies on ActiveJob's retry functionality. -ActiveJob can be configured to retry an infinite number of times, with an exponential backoff. Using ActiveJob's `retry_on` prevents exceptions from reaching GoodJob: +ActiveJob can be configured to retry an infinite number of times, with a polynomial backoff. Using ActiveJob's `retry_on` prevents exceptions from reaching GoodJob: ```ruby class ApplicationJob < ActiveJob::Base diff --git a/lib/good_job/active_job_extensions/concurrency.rb b/lib/good_job/active_job_extensions/concurrency.rb index a25bb42ed..0bf4342fe 100644 --- a/lib/good_job/active_job_extensions/concurrency.rb +++ b/lib/good_job/active_job_extensions/concurrency.rb @@ -36,10 +36,16 @@ def deserialize(job_data) end end + wait_key = if ActiveJob.gem_version >= Gem::Version.new("7.1.0") + :polynomially_longer + else + :exponentially_longer + end + retry_on( GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError, attempts: Float::INFINITY, - wait: :exponentially_longer + wait: wait_key ) before_perform do |job|