mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
other example
This commit is contained in:
parent
959561e6f9
commit
f074cce972
1 changed files with 22 additions and 1 deletions
|
@ -7,7 +7,9 @@ smoothly.
|
|||
|
||||
## Nested Batches
|
||||
|
||||
Batches can now be nested within the `jobs` method for more complex job workflows.
|
||||
Batches can now be nested within the `jobs` method.
|
||||
This feature enables Sidekiq Pro to handle workflow processing of any size
|
||||
and complexity!
|
||||
|
||||
```ruby
|
||||
a = Sidekiq::Batch.new
|
||||
|
@ -27,6 +29,25 @@ Parent batch callbacks are not processed until any child batch callbacks have
|
|||
run successfully. In the example above, `MyCallback` will always fire
|
||||
before `SomeCallback` because `b` is considered a child of `a`.
|
||||
|
||||
Of course you can dynamically add child batches while a batch job is executing.
|
||||
|
||||
```ruby
|
||||
def perform(*args)
|
||||
do_something(args)
|
||||
|
||||
if more_work?
|
||||
# Sidekiq::Worker#batch returns the Batch this job is part of.
|
||||
batch.jobs do
|
||||
b = Sidekiq::Batch.new
|
||||
b.on(:success, MyCallback)
|
||||
b.jobs do
|
||||
OtherWork.perform_async
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
## Batch Data
|
||||
|
||||
The batch data model was overhauled. Batch data should take
|
||||
|
|
Loading…
Add table
Reference in a new issue