Add bulk enqueue support to ActiveJob adapter#422
Open
dtcristo wants to merge 4 commits intoque-rb:masterfrom
Open
Add bulk enqueue support to ActiveJob adapter#422dtcristo wants to merge 4 commits intoque-rb:masterfrom
dtcristo wants to merge 4 commits intoque-rb:masterfrom
Conversation
[Bundler 2.5 dropped support for Ruby 2.7](https://github.com/rubygems/rubygems/releases/tag/bundler-v2.5.0). Since we are testing with Ruby 2.7, we should pin the version of Bundler to 2.4.x since this is the last version that's compatible with 2.7.
Prepare spec for bulk enqueue refactor to support bulk enqueue of jobs with differing job class and job options.
Allow bulk enqueue of multiple different job classes and differing job options in a single `.bulk_enqueue` block. Each job can now differ by job class, queue, priority, run at and tags (in addition to args and kwargs).
When using ActiveJob, you can now enqueue jobs in bulk using either
`Que.bulk_enqueue`:
```ruby
Que.bulk_enqueue do
TestJobClass.perform_later(1, 2)
OtherTestJobClass.set(wait: 1.minute, queue: 'custom', priority: 200).perform_later(3, 4)
end
```
Or when running Rails >= 7.1 using `ActiveJob.perform_all_later`:
```ruby
ActiveJob.perform_all_later([
TestJobClass.new(1, 2),
OtherTestJobClass.new(3, 4).set(wait: 1.minute, queue: 'custom', priority: 200),
])
```
890981f to
691dd68
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Built on top of #420, merge that first.
When using ActiveJob, you can now enqueue jobs in bulk using either
Que.bulk_enqueue:Or when running Rails >= 7.1 using
ActiveJob.perform_all_later: