From e49fb7921e94d533ed39c197cf0287120d389b28 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Wed, 25 Jul 2018 17:30:38 +0900 Subject: Increment execution count before deserialize arguments Currently, the execution count increments after deserializes arguments. Therefore, if an error occurs with deserialize, it retries indefinitely. In order to prevent this, the count is moved before deserialize. Fixes #33344. --- activejob/test/jobs/retry_job.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activejob/test/jobs') diff --git a/activejob/test/jobs/retry_job.rb b/activejob/test/jobs/retry_job.rb index 1383fffd7d..68dc17e16c 100644 --- a/activejob/test/jobs/retry_job.rb +++ b/activejob/test/jobs/retry_job.rb @@ -24,6 +24,7 @@ class RetryJob < ActiveJob::Base retry_on ExponentialWaitTenAttemptsError, wait: :exponentially_longer, attempts: 10 retry_on CustomWaitTenAttemptsError, wait: ->(executions) { executions * 2 }, attempts: 10 retry_on(CustomCatchError) { |job, error| JobBuffer.add("Dealt with a job that failed to retry in a custom way after #{job.arguments.second} attempts. Message: #{error.message}") } + retry_on(ActiveJob::DeserializationError) { |job, error| JobBuffer.add("Raised #{error.class} for the #{job.executions} time") } discard_on DiscardableError discard_on FirstDiscardableErrorOfTwo, SecondDiscardableErrorOfTwo -- cgit v1.2.3