2016-02-05 09:35:37 -05:00
|
|
|
* Change the default adapter from inline to async. It's a better default as tests will then not mistakenly
|
|
|
|
come to rely on behavior happening synchronously. This is especially important with things like jobs kicked off
|
|
|
|
in Active Record lifecycle callbacks.
|
|
|
|
|
|
|
|
*DHH*
|
|
|
|
|
|
|
|
|
2016-02-01 16:27:38 -05:00
|
|
|
## Rails 5.0.0.beta2 (February 01, 2016) ##
|
|
|
|
|
|
|
|
* No changes.
|
|
|
|
|
|
|
|
|
2015-12-18 15:58:25 -05:00
|
|
|
## Rails 5.0.0.beta1 (December 18, 2015) ##
|
|
|
|
|
2015-10-03 09:18:25 -04:00
|
|
|
* Fixed serializing `:at` option for `assert_enqueued_with`
|
2015-10-05 03:01:12 -04:00
|
|
|
and `assert_performed_with`.
|
2015-10-03 09:18:25 -04:00
|
|
|
|
|
|
|
*Wojciech Wnętrzak*
|
|
|
|
|
2015-10-03 07:25:16 -04:00
|
|
|
* Support passing array to `assert_enqueued_jobs` in `:only` option.
|
|
|
|
|
|
|
|
*Wojciech Wnętrzak*
|
|
|
|
|
2015-03-18 05:48:26 -04:00
|
|
|
* Add job priorities to Active Job.
|
|
|
|
|
|
|
|
*wvengen*
|
|
|
|
|
2015-08-15 23:41:33 -04:00
|
|
|
* Implement a simple `AsyncJob` processor and associated `AsyncAdapter` that
|
|
|
|
queue jobs to a `concurrent-ruby` thread pool.
|
|
|
|
|
|
|
|
*Jerry D'Antonio*
|
|
|
|
|
2015-08-13 03:56:06 -04:00
|
|
|
* Implement `provider_job_id` for `queue_classic` adapter. This requires the
|
|
|
|
latest, currently unreleased, version of queue_classic.
|
|
|
|
|
|
|
|
*Yves Senn*
|
|
|
|
|
2015-07-23 18:45:07 -04:00
|
|
|
* `assert_enqueued_with` and `assert_performed_with` now returns the matched
|
|
|
|
job instance for further assertions.
|
2015-08-13 03:56:06 -04:00
|
|
|
|
2015-07-23 18:45:07 -04:00
|
|
|
*Jean Boussier*
|
|
|
|
|
2015-12-23 04:05:11 -05:00
|
|
|
* Include `I18n.locale` into job serialization/deserialization and use it around
|
2015-07-07 15:52:28 -04:00
|
|
|
`perform`.
|
|
|
|
|
|
|
|
Fixes #20799.
|
|
|
|
|
|
|
|
*Johannes Opper*
|
|
|
|
|
2015-05-07 18:32:15 -04:00
|
|
|
* Allow `DelayedJob`, `Sidekiq`, `qu`, and `que` to report the job id back to
|
2015-05-07 11:25:49 -04:00
|
|
|
`ActiveJob::Base` as `provider_job_id`.
|
2015-04-26 13:05:08 -04:00
|
|
|
|
|
|
|
Fixes #18821.
|
|
|
|
|
2015-05-31 05:24:36 -04:00
|
|
|
*Kevin Deisz*, *Jeroen van Baarsen*
|
2015-04-26 13:05:08 -04:00
|
|
|
|
2015-05-01 02:53:18 -04:00
|
|
|
* `assert_enqueued_jobs` and `assert_performed_jobs` in block form use the
|
|
|
|
given number as expected value. This makes the error message much easier to
|
|
|
|
understand.
|
|
|
|
|
|
|
|
*y-yagi*
|
|
|
|
|
2015-05-16 01:30:17 -04:00
|
|
|
* A generated job now inherits from `app/jobs/application_job.rb` by default.
|
2015-03-30 08:31:16 -04:00
|
|
|
|
|
|
|
*Jeroen van Baarsen*
|
|
|
|
|
2015-02-08 08:52:47 -05:00
|
|
|
* Add an `:only` option to `perform_enqueued_jobs` to filter jobs based on
|
|
|
|
type.
|
|
|
|
|
|
|
|
This allows specific jobs to be tested, while preventing others from
|
|
|
|
being performed unnecessarily.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
def test_hello_job
|
|
|
|
assert_performed_jobs 1, only: HelloJob do
|
|
|
|
HelloJob.perform_later('jeremy')
|
|
|
|
LoggingJob.perform_later
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
An array may also be specified, to support testing multiple jobs.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
def test_hello_and_logging_jobs
|
|
|
|
assert_nothing_raised do
|
|
|
|
assert_performed_jobs 2, only: [HelloJob, LoggingJob] do
|
|
|
|
HelloJob.perform_later('jeremy')
|
|
|
|
LoggingJob.perform_later('stewie')
|
|
|
|
RescueJob.perform_later('david')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Fixes #18802.
|
|
|
|
|
|
|
|
*Michael Ryan*
|
|
|
|
|
2015-01-30 15:40:49 -05:00
|
|
|
* Allow keyword arguments to be used with Active Job.
|
|
|
|
|
|
|
|
Fixes #18741.
|
|
|
|
|
|
|
|
*Sean Griffin*
|
|
|
|
|
2015-01-08 04:40:00 -05:00
|
|
|
* Add `:only` option to `assert_enqueued_jobs`, to check the number of times
|
2015-01-10 06:17:57 -05:00
|
|
|
a specific kind of job is enqueued.
|
|
|
|
|
|
|
|
Example:
|
2015-01-08 04:40:00 -05:00
|
|
|
|
|
|
|
def test_logging_job
|
|
|
|
assert_enqueued_jobs 1, only: LoggingJob do
|
|
|
|
LoggingJob.perform_later
|
|
|
|
HelloJob.perform_later('jeremy')
|
|
|
|
end
|
2015-01-07 23:33:01 -05:00
|
|
|
end
|
|
|
|
|
2015-01-08 04:40:00 -05:00
|
|
|
*George Claghorn*
|
2014-12-30 13:26:39 -05:00
|
|
|
|
2015-01-08 04:40:00 -05:00
|
|
|
* `ActiveJob::Base.deserialize` delegates to the job class.
|
2014-12-31 10:31:25 -05:00
|
|
|
|
|
|
|
Since `ActiveJob::Base#deserialize` can be overridden by subclasses (like
|
|
|
|
`ActiveJob::Base#serialize`) this allows jobs to attach arbitrary metadata
|
2015-01-10 06:17:57 -05:00
|
|
|
when they get serialized and read it back when they get performed.
|
|
|
|
|
|
|
|
Example:
|
2014-12-30 13:26:39 -05:00
|
|
|
|
2015-01-08 04:40:00 -05:00
|
|
|
class DeliverWebhookJob < ActiveJob::Base
|
|
|
|
def serialize
|
|
|
|
super.merge('attempt_number' => (@attempt_number || 0) + 1)
|
|
|
|
end
|
2014-12-30 13:26:39 -05:00
|
|
|
|
2015-01-08 04:40:00 -05:00
|
|
|
def deserialize(job_data)
|
|
|
|
super
|
|
|
|
@attempt_number = job_data['attempt_number']
|
|
|
|
end
|
2014-12-30 13:26:39 -05:00
|
|
|
|
2015-01-08 04:40:00 -05:00
|
|
|
rescue_from(TimeoutError) do |exception|
|
|
|
|
raise exception if @attempt_number > 5
|
|
|
|
retry_job(wait: 10)
|
|
|
|
end
|
2014-12-30 13:26:39 -05:00
|
|
|
end
|
|
|
|
|
2014-12-31 10:31:25 -05:00
|
|
|
*Isaac Seymour*
|
2014-12-30 13:26:39 -05:00
|
|
|
|
2014-11-28 12:00:06 -05:00
|
|
|
Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activejob/CHANGELOG.md) for previous changes.
|