diff options
Diffstat (limited to 'activejob/CHANGELOG.md')
-rw-r--r-- | activejob/CHANGELOG.md | 153 |
1 files changed, 24 insertions, 129 deletions
diff --git a/activejob/CHANGELOG.md b/activejob/CHANGELOG.md index 229ef03879..5e8d8cb5c9 100644 --- a/activejob/CHANGELOG.md +++ b/activejob/CHANGELOG.md @@ -1,146 +1,41 @@ -* 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. +* Removed deprecated support to passing the adapter class to `.queue_adapter`. - *DHH* - - -## Rails 5.0.0.beta2 (February 01, 2016) ## - -* No changes. - - -## Rails 5.0.0.beta1 (December 18, 2015) ## - -* Fixed serializing `:at` option for `assert_enqueued_with` - and `assert_performed_with`. - - *Wojciech Wnętrzak* - -* Support passing array to `assert_enqueued_jobs` in `:only` option. - - *Wojciech Wnętrzak* - -* Add job priorities to Active Job. - - *wvengen* - -* Implement a simple `AsyncJob` processor and associated `AsyncAdapter` that - queue jobs to a `concurrent-ruby` thread pool. - - *Jerry D'Antonio* - -* Implement `provider_job_id` for `queue_classic` adapter. This requires the - latest, currently unreleased, version of queue_classic. - - *Yves Senn* - -* `assert_enqueued_with` and `assert_performed_with` now returns the matched - job instance for further assertions. - - *Jean Boussier* - -* Include `I18n.locale` into job serialization/deserialization and use it around - `perform`. - - Fixes #20799. - - *Johannes Opper* - -* Allow `DelayedJob`, `Sidekiq`, `qu`, and `que` to report the job id back to - `ActiveJob::Base` as `provider_job_id`. - - Fixes #18821. - - *Kevin Deisz*, *Jeroen van Baarsen* + *Rafael Mendonça França* -* `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. +* Removed deprecated `#original_exception` in `ActiveJob::DeserializationError`. - *y-yagi* + *Rafael Mendonça França* -* A generated job now inherits from `app/jobs/application_job.rb` by default. +* Added instance variable `@queue` to JobWrapper. - *Jeroen van Baarsen* + This will fix issues in [resque-scheduler](https://github.com/resque/resque-scheduler) `#job_to_hash` method, + so we can use `#enqueue_delayed_selection`, `#remove_delayed` method in resque-scheduler smoothly. -* Add an `:only` option to `perform_enqueued_jobs` to filter jobs based on - type. + *mu29* - This allows specific jobs to be tested, while preventing others from - being performed unnecessarily. +* Yield the job instance so you have access to things like `job.arguments` on the custom logic after retries fail. - 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* - -* Allow keyword arguments to be used with Active Job. - - Fixes #18741. + *DHH* - *Sean Griffin* +* Added declarative exception handling via `ActiveJob::Base.retry_on` and `ActiveJob::Base.discard_on`. -* Add `:only` option to `assert_enqueued_jobs`, to check the number of times - a specific kind of job is enqueued. + Examples: - Example: + class RemoteServiceJob < ActiveJob::Base + retry_on CustomAppException # defaults to 3s wait, 5 attempts + retry_on AnotherCustomAppException, wait: ->(executions) { executions * 2 } + retry_on ActiveRecord::Deadlocked, wait: 5.seconds, attempts: 3 + retry_on Net::OpenTimeout, wait: :exponentially_longer, attempts: 10 + discard_on ActiveJob::DeserializationError - def test_logging_job - assert_enqueued_jobs 1, only: LoggingJob do - LoggingJob.perform_later - HelloJob.perform_later('jeremy') + def perform(*args) + # Might raise CustomAppException or AnotherCustomAppException for something domain specific + # Might raise ActiveRecord::Deadlocked when a local db deadlock is detected + # Might raise Net::OpenTimeout when the remote service is down end end - *George Claghorn* - -* `ActiveJob::Base.deserialize` delegates to the job class. - - Since `ActiveJob::Base#deserialize` can be overridden by subclasses (like - `ActiveJob::Base#serialize`) this allows jobs to attach arbitrary metadata - when they get serialized and read it back when they get performed. - - Example: - - class DeliverWebhookJob < ActiveJob::Base - def serialize - super.merge('attempt_number' => (@attempt_number || 0) + 1) - end - - def deserialize(job_data) - super - @attempt_number = job_data['attempt_number'] - end - - rescue_from(TimeoutError) do |exception| - raise exception if @attempt_number > 5 - retry_job(wait: 10) - end - end + *DHH* - *Isaac Seymour* -Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activejob/CHANGELOG.md) for previous changes. +Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/activejob/CHANGELOG.md) for previous changes. |