2020-04-08 17:22:38 -04:00
|
|
|
* While using `perform_enqueued_jobs` test helper enqueued jobs must be stored for the later check with
|
|
|
|
`assert_enqueued_with`.
|
|
|
|
|
|
|
|
*Dmitry Polushkin*
|
|
|
|
|
2020-03-16 14:40:48 -04:00
|
|
|
* `ActiveJob::TestCase#perform_enqueued_jobs` without a block removes performed jobs from the queue.
|
|
|
|
|
|
|
|
That way the helper can be called multiple times and not perform a job invocation multiple times.
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
def test_jobs
|
|
|
|
HelloJob.perform_later("rafael")
|
2020-03-19 18:29:18 -04:00
|
|
|
perform_enqueued_jobs # only runs with "rafael"
|
2020-03-16 14:40:48 -04:00
|
|
|
HelloJob.perform_later("david")
|
|
|
|
perform_enqueued_jobs # only runs with "david"
|
|
|
|
end
|
|
|
|
```
|
|
|
|
|
2020-04-15 08:23:24 -04:00
|
|
|
*Étienne Barrié*
|
|
|
|
|
2020-03-09 19:33:27 -04:00
|
|
|
* `ActiveJob::TestCase#perform_enqueued_jobs` will no longer perform retries:
|
|
|
|
|
|
|
|
When calling `perform_enqueued_jobs` without a block, the adapter will
|
|
|
|
now perform jobs that are **already** in the queue. Jobs that will end up in
|
|
|
|
the queue afterwards won't be performed.
|
|
|
|
|
|
|
|
This change only affects `perform_enqueued_jobs` when no block is given.
|
|
|
|
|
|
|
|
*Edouard Chin*
|
|
|
|
|
2020-04-15 08:23:24 -04:00
|
|
|
* Add queue name support to Que adapter.
|
2020-03-04 07:32:23 -05:00
|
|
|
|
|
|
|
*Brad Nauta*, *Wojciech Wnętrzak*
|
|
|
|
|
2019-11-28 07:56:49 -05:00
|
|
|
* Don't run `after_enqueue` and `after_perform` callbacks if the callback chain is halted.
|
|
|
|
|
|
|
|
class MyJob < ApplicationJob
|
|
|
|
before_enqueue { throw(:abort) }
|
|
|
|
after_enqueue { # won't enter here anymore }
|
|
|
|
end
|
|
|
|
|
|
|
|
`after_enqueue` and `after_perform` callbacks will no longer run if the callback chain is halted.
|
|
|
|
This behaviour is a breaking change and won't take effect until Rails 6.2.
|
|
|
|
To enable this behaviour in your app right now, you can add in your app's configuration file
|
2020-04-15 08:23:24 -04:00
|
|
|
`config.active_job.skip_after_callbacks_if_terminated = true`.
|
2019-11-28 07:56:49 -05:00
|
|
|
|
|
|
|
*Edouard Chin*
|
|
|
|
|
2019-11-28 17:40:24 -05:00
|
|
|
* Fix enqueuing and performing incorrect logging message.
|
|
|
|
|
|
|
|
Jobs will no longer always log "Enqueued MyJob" or "Performed MyJob" when they actually didn't get enqueued/performed.
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
class MyJob < ApplicationJob
|
|
|
|
before_enqueue { throw(:abort) }
|
|
|
|
end
|
|
|
|
|
2020-01-14 22:11:40 -05:00
|
|
|
MyJob.perform_later # Will no longer log "Enqueued MyJob" since job wasn't even enqueued through adapter.
|
2019-11-28 17:40:24 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
A new message will be logged in case a job couldn't be enqueued, either because the callback chain was halted or
|
|
|
|
because an exception happened during enqueing. (i.e. Redis is down when you try to enqueue your job)
|
|
|
|
|
|
|
|
*Edouard Chin*
|
|
|
|
|
2019-11-07 14:06:06 -05:00
|
|
|
* Add an option to disable logging of the job arguments when enqueuing and executing the job.
|
|
|
|
|
|
|
|
class SensitiveJob < ApplicationJob
|
|
|
|
self.log_arguments = false
|
|
|
|
|
|
|
|
def perform(my_sensitive_argument)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-11-09 09:13:07 -05:00
|
|
|
When dealing with sensitive arguments as password and tokens it is now possible to configure the job
|
2019-11-07 14:06:06 -05:00
|
|
|
to not put the sensitive argument in the logs.
|
|
|
|
|
|
|
|
*Rafael Mendonça França*
|
|
|
|
|
2019-11-23 19:20:00 -05:00
|
|
|
* Changes in `queue_name_prefix` of a job no longer affects all other jobs.
|
|
|
|
|
|
|
|
Fixes #37084.
|
2019-09-11 20:20:09 -04:00
|
|
|
|
|
|
|
*Lucas Mansur*
|
|
|
|
|
2019-09-09 16:42:16 -04:00
|
|
|
* Allow `Class` and `Module` instances to be serialized.
|
|
|
|
|
|
|
|
*Kevin Deisz*
|
|
|
|
|
2019-11-23 19:20:00 -05:00
|
|
|
* Log potential matches in `assert_enqueued_with` and `assert_performed_with`.
|
2019-08-12 15:12:23 -04:00
|
|
|
|
|
|
|
*Gareth du Plooy*
|
|
|
|
|
2019-08-07 11:09:23 -04:00
|
|
|
* Add `at` argument to the `perform_enqueued_jobs` test helper.
|
|
|
|
|
|
|
|
*John Crepezzi*, *Eileen Uchitelle*
|
|
|
|
|
2019-07-25 18:41:15 -04:00
|
|
|
* `assert_enqueued_with` and `assert_performed_with` can now test jobs with relative delay.
|
|
|
|
|
|
|
|
*Vlado Cingel*
|
2019-04-12 11:24:05 -04:00
|
|
|
|
2020-03-11 12:17:53 -04:00
|
|
|
* Add jitter to `ActiveJob::Exceptions.retry_on`.
|
2018-02-02 11:50:57 -05:00
|
|
|
|
2020-03-11 12:17:53 -04:00
|
|
|
`ActiveJob::Exceptions.retry_on` now uses a random amount of jitter in order to
|
2020-02-25 00:14:54 -05:00
|
|
|
prevent the [thundering herd effect](https://en.wikipedia.org/wiki/Thundering_herd_problem). Defaults to
|
2018-02-02 11:50:57 -05:00
|
|
|
15% (represented as 0.15) but overridable via the `:jitter` option when using `retry_on`.
|
2020-02-25 00:14:54 -05:00
|
|
|
Jitter is applied when an `Integer`, `ActiveSupport::Duration` or `:exponentially_longer`, is passed to the `wait` argument in `retry_on`.
|
2018-02-02 11:50:57 -05:00
|
|
|
|
2020-02-25 00:14:54 -05:00
|
|
|
```ruby
|
2018-02-02 11:50:57 -05:00
|
|
|
retry_on(MyError, wait: :exponentially_longer, jitter: 0.30)
|
2020-02-25 00:14:54 -05:00
|
|
|
```
|
2018-02-02 11:50:57 -05:00
|
|
|
|
|
|
|
*Anthony Ross*
|
|
|
|
|
2019-04-12 11:24:05 -04:00
|
|
|
|
2019-04-24 15:57:14 -04:00
|
|
|
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activejob/CHANGELOG.md) for previous changes.
|