ignoreDependencyOnFailure option allows the parent to complete without waiting for failed children, while still tracking which children failed.
How It Works
TheignoreDependencyOnFailure option makes sure that when a job fails, the dependency is ignored from the parent, so the parent will complete without waiting for the failed children. Unlike removeDependencyOnFailure, the failed children are still tracked and can be retrieved later.
As soon as a child with this option fails, the parent job will be moved to a waiting state only if there are no more pending children.
Basic Usage
Retrieving Ignored Failures
Failed children using this option can be retrieved by thegetIgnoredChildrenFailures method:
Behavior
When a child job withignoreDependencyOnFailure: true fails:
- The dependency is marked as “ignored” in the parent
- The failed child is still tracked in the parent’s dependencies
- The parent can complete without waiting for this child
- If this was the last pending child, the parent moves to waiting state
- You can retrieve ignored failures using
getIgnoredChildrenFailures()
1
Child job fails
A child with
ignoreDependencyOnFailure: true encounters an error and moves to failed state.2
Dependency marked ignored
BullMQ marks this child as “ignored” in the parent’s dependency list.
3
Check remaining dependencies
If there are still other pending children, the parent continues waiting.
4
Parent becomes active
Once all other children complete, the parent moves to waiting state and can be processed.
5
Access ignored failures
Parent processor can retrieve information about ignored failures using
getIgnoredChildrenFailures().Complete Example
Use Cases
Optional Services with Monitoring
Optional Services with Monitoring
Track which optional services failed while still completing the main workflow:
Data Processing with Optional Enrichments
Data Processing with Optional Enrichments
Process data with optional enrichment steps while tracking which enrichments failed:
Multi-Channel Notifications with Fallback
Multi-Channel Notifications with Fallback
Send notifications across multiple channels and track which channels failed:
Difference from removeDependencyOnFailure
Understanding when to useignoreDependencyOnFailure vs removeDependencyOnFailure:
ignoreDependencyOnFailure
Use when:
- You need to track which children failed
- You want to log or monitor failures
- You need to make decisions based on failure information
- You want better observability
- Keeps failed child in dependencies as “ignored”
- Can retrieve failure info with
getIgnoredChildrenFailures() - Better for debugging and monitoring
removeDependencyOnFailure
Use when:
- You don’t need to track failures
- You want to completely forget about failed children
- You want simpler cleanup
- Failure information is not important
- Completely removes failed child from dependencies
- Cannot retrieve failure information
- Cleaner but less observable
Monitoring Ignored Dependencies
Track ignored dependencies for better observability:Advanced Pattern: Retry Failed Optional Steps
You can implement a pattern where the parent retries failed optional steps:Getting Dependency Counts
You can check how many children were ignored:Best Practices
Always Check Ignored Failures
Use
getIgnoredChildrenFailures() in parent processor to handle failure scenariosLog for Observability
Log ignored failures to monitoring systems for tracking and alerting
Use for Non-Critical Features
Apply to features that enhance but aren’t critical to the workflow
Consider Retry Logic
Implement retry mechanisms for failed optional steps when appropriate
