Remove deprecated `:exponentially_longer` value for the `:wait` in `retry_on`

This commit is contained in:
Rafael Mendonça França 2023-10-12 19:26:25 +00:00
parent 798289699d
commit 03dae98092
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
4 changed files with 7 additions and 31 deletions

View File

@ -1,3 +1,7 @@
* Remove deprecated `:exponentially_longer` value for the `:wait` in `retry_on`.
*Rafael Mendonça França*
* Remove deprecated support to set numeric values to `scheduled_at` attribute.
*Rafael Mendonça França*

View File

@ -60,12 +60,6 @@ module ActiveJob
# end
# end
def retry_on(*exceptions, wait: 3.seconds, attempts: 5, queue: nil, priority: nil, jitter: JITTER_DEFAULT)
if wait == :exponentially_longer
ActiveJob.deprecator.warn(<<~MSG.squish)
`wait: :exponentially_longer` will actually wait polynomially longer and is therefore deprecated.
Prefer `wait: :polynomially_longer` to avoid confusion and keep the same behavior.
MSG
end
rescue_from(*exceptions) do |error|
executions = executions_for(exceptions)
if attempts == :unlimited || executions < attempts
@ -168,7 +162,7 @@ module ActiveJob
jitter = jitter == JITTER_DEFAULT ? self.class.retry_jitter : (jitter || 0.0)
case seconds_or_duration_or_algorithm
when :exponentially_longer, :polynomially_longer
when :polynomially_longer
# This delay uses a polynomial backoff strategy, which was previously misnamed as exponential
delay = executions**4
delay_jitter = determine_jitter_for_delay(delay, jitter)

View File

@ -379,29 +379,5 @@ class ExceptionsTest < ActiveSupport::TestCase
]
assert_equal expected_array, JobBuffer.values.last(2)
end
class ::LegacyExponentialNamingError < StandardError; end
test "wait: :exponentially_longer is deprecated but still works" do
assert_deprecated(ActiveJob.deprecator) do
class LegacyRetryJob < RetryJob
retry_on LegacyExponentialNamingError, wait: :exponentially_longer, attempts: 10, jitter: nil
end
end
travel_to Time.now
LegacyRetryJob.perform_later "LegacyExponentialNamingError", 5, :log_scheduled_at
assert_equal [
"Raised LegacyExponentialNamingError for the 1st time",
"Next execution scheduled at #{(Time.now + 3.seconds).to_f}",
"Raised LegacyExponentialNamingError for the 2nd time",
"Next execution scheduled at #{(Time.now + 18.seconds).to_f}",
"Raised LegacyExponentialNamingError for the 3rd time",
"Next execution scheduled at #{(Time.now + 83.seconds).to_f}",
"Raised LegacyExponentialNamingError for the 4th time",
"Next execution scheduled at #{(Time.now + 258.seconds).to_f}",
"Successfully completed job"
], JobBuffer.values
end
end
end

View File

@ -149,6 +149,8 @@ Please refer to the [Changelog][active-job] for detailed changes.
* Remove deprecated support to set numeric values to `scheduled_at` attribute.
* Remove deprecated `:exponentially_longer` value for the `:wait` in `retry_on`.
### Deprecations
* Deprecate `Rails.application.config.active_job.use_big_decimal_serialize`.