v3.0.0 - `enqueue_all` & `perform_all_later` support!
·
18 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
Changes incorporated into this release are primarily in support of enqueue_all and by extension ActiveJob.perform_all_later.
run_at/namedefaulting moved from a before_save callback into Delayed::Backend::JobPreparer- Callers that bypass Delayed::Job.enqueue (e.g. raw Delayed::Job.create! / .save) will no longer have these defaulted and must supply them explicitly
- Support for the
:enqueuehook is now removed. Delayed jobs defining an:enqueuemethod will now raise upon enqueue indicating lack of support Delayed::Worker.delay_jobsmay no longer be a Proc. Job enqueues will raise if a Proc is assigned- The ActiveJob adapter now properly sets
successfully_enqueuedupon jobs being enqueued - ActiveJobs explicitly will no longer be accepted directly to
Delayed::Job.enqueueandDelayed::Job.enqueue_all. - Both
Delayed::Joband the ActiveJob adapter now supportenqueue_all(enablingperform_all_later)- For all ActiveJob enqueue methods(
perform_later,perform_all_later),provider_job_idis now only set for applications whereActiveRecord::Base.connection.supports_insert_returning? == true(ie: Postgres + SQLite on Rails 7.1+) - The
:enqueuelifecycle event now accepts an array of jobs rather than a single job - Similarly, the
delayed.job.enqueueActiveSupport notification now emits a hash with an array ofjobs(see more in upgrade guide)
- For all ActiveJob enqueue methods(
Upgrade Guide
Recommended:
- Apply new migrations to mark
run_atandnameas non-nullable columns ondelayed_jobs08_add_run_at_and_name_not_null_check.rbto set up unvalidated constraints(Postgres only)09_validate_run_at_and_name_not_null.rbto markrun_atandnameas non-nullable- You must backfill
run_atandnamefor this migration to run successfully
- You must backfill
Required:
- Remove any
enqueuehooks you have onDelayed::Job - Ensure
Delayed::Worker.delay_jobsis never set to a Proc within your application- Ensure
Delayed::Worker.delay_job?(job)is no longer used, as it was removed
- Ensure
- Ensure you have no instances of passing an ActiveJob directly to
Delayed::Job.enqueue, switching to useperform_laterinstead - Audit your usage of
provider_job_idif your backing database does not support insert returning - Adjust your lifecycle callback plugins to ensure your consumption of the
:enqueueexpects an array of jobs - Adjust your consumption of the
delayed.job.enqueueActiveSupport notification
Full Changelog
- fix: Update changelog_uri to GH releases by @smudge in #101
- style: Add (passing) tests for regression coverage by @smudge in #102
- refactor: Push run_at / name defaulting into JobPreparer by @CelticMajora in #104
- refactor: deprecate :enqueue job hook by @CelticMajora in #106
- refactor: Drop support for Delayed::Worker.delay_jobs being proc by @CelticMajora in #108
- feat: Implement enqueue_all by @CelticMajora in #103
- fix: switch aj adapter to pipe through enqueue_all by @CelticMajora in #111
- fix: README to reflect accurate enqueue lifecycle shape by @CelticMajora in #112
- fix: Assert ActiveJobs can not be passed directly to DJ enqueue methods without going through the adapter by @CelticMajora in #113
New Contributors
- @CelticMajora made their first contribution in #104
Full Changelog: v2.2.0...v3.0.0