Overview
Throw WaitingChildrenError from a job processor to move the job to thewaiting-children state, indicating that it’s waiting for child jobs to complete.
Class
Usage
This error is typically handled internally by BullMQ when using FlowProducer. You rarely need to throw it manually.
Behavior
When WaitingChildrenError is thrown:- The job is moved from
activetowaiting-childrenstate - The job waits for its child jobs to complete
- Once all children are completed, the job moves to
waitingstate - The parent job is then processed and can access children results
Common Use Case: FlowProducer
FlowProducer automatically handles this for parent-child jobs:Manual Child Job Creation
You can manually create child jobs and use WaitingChildrenError:Accessing Child Results
When children complete, the parent can access their results:Monitoring Waiting Children
Checking Waiting Children State
Child Job Failure Handling
Control how parent jobs handle child failures:Example: Multi-Stage Processing
When to Use WaitingChildrenError
- When using FlowProducer (handled automatically)
- Manual parent-child job relationships
- Multi-stage job processing
- Aggregating results from parallel jobs
Related
- FlowProducer - Create job flows with dependencies
- DelayedError - Delay job processing
- Job.getChildrenValues() - Get child job results
- Job.getDependencies() - Get child job status
