* Keep executions for each specific declaration
Fixes #34337
ActiveJob used the global executions counter to control the number of
times a job should be retried. The problem with this approach was that
in case a job raised different exceptions during its executions they
weren't retried the number of times defined by their `attemps` number.
**Example:**
Having the following job:
```ruby
class BuggyJob < ActiveJob::Base
retry_on CustomException, attemps: 3
retry_on OtherException, attempts: 3
end
```
If the job raised `CustomException` in the first two executions and then
it raised `OtherException`, the job wasn't retried anymore because the
global executions counter was already indicating 3 attempts.
With this patch each `retry_on` declaration has its specific counter so
that the first two executions that raise `CustomException` don't affect
the retries count that future exceptions may have.
* Revert "clarifies documentation around the attempts arugment to retry_on"
This reverts commit 86aa8f8c56
.
3 KiB
-
Keep executions for each specific declaration
Each
retry_on
declaration has now its own specific executions counter. Before it was shared between all executions of a job.Alberto Almagro
-
Allow all assertion helpers that have a
only
andexcept
keyword to accept Procs.Edouard Chin
-
Restore HashWithIndifferentAccess support to ActiveJob::Arguments.deserialize.
Gannon McGibbon
-
Include deserialized arguments in job instances returned from
assert_enqueued_with
andassert_performed_with
Alan Wu
-
Allow
assert_enqueued_with
/assert_performed_with
methods to accept a proc for theargs
argument. This is useful to check if only a subset of arguments matches your expectations.Edouard Chin
-
ActionDispatch::IntegrationTest
includesActiveJob::TestHelper
module by default.Ricardo Díaz
-
Added
enqueue_retry.active_job
,retry_stopped.active_job
, anddiscard.active_job
hooks.steves
-
Allow
assert_performed_with
to be called without a block.bogdanvlviv
-
Execution of
assert_performed_jobs
, andassert_no_performed_jobs
without a block should respect passed:except
,:only
, and:queue
options.bogdanvlviv
-
Allow
:queue
option to job assertions and helpers.bogdanvlviv
-
Allow
perform_enqueued_jobs
to be called without a block.Performs all of the jobs that have been enqueued up to this point in the test.
Kevin Deisz
-
Move
enqueue
/enqueue_at
notifications to an around callback.Improves timing accuracy over the old after callback by including time spent writing to the adapter's IO implementation.
Zach Kemp
-
Allow call
assert_enqueued_with
with no block.Example:
def test_assert_enqueued_with MyJob.perform_later(1,2,3) assert_enqueued_with(job: MyJob, args: [1,2,3], queue: 'low') MyJob.set(wait_until: Date.tomorrow.noon).perform_later assert_enqueued_with(job: MyJob, at: Date.tomorrow.noon) end
bogdanvlviv
-
Allow passing multiple exceptions to
retry_on
, anddiscard_on
.George Claghorn
-
Pass the error instance as the second parameter of block executed by
discard_on
.Fixes #32853.
Yuji Yaginuma
-
Remove support for Qu gem.
Reasons are that the Qu gem wasn't compatible since Rails 5.1, gem development was stopped in 2014 and maintainers have confirmed its demise. See issue #32273
Alberto Almagro
-
Add support for timezones to Active Job.
Record what was the current timezone in effect when the job was enqueued and then restore when the job is executed in same way that the current locale is recorded and restored.
Andrew White
-
Rails 6 requires Ruby 2.4.1 or newer.
Jeremy Daer
-
Add support to define custom argument serializers.
Evgenii Pecherkin, Rafael Mendonça França
Please check 5-2-stable for previous changes.