Skip to main content
In some situations, you may have a parent job and need to ignore when one of its children fails. The ignoreDependencyOnFailure option allows the parent to complete without waiting for failed children, while still tracking which children failed.

How It Works

The ignoreDependencyOnFailure 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 the getIgnoredChildrenFailures method:

Behavior

When a child job with ignoreDependencyOnFailure: true fails:
  1. The dependency is marked as “ignored” in the parent
  2. The failed child is still tracked in the parent’s dependencies
  3. The parent can complete without waiting for this child
  4. If this was the last pending child, the parent moves to waiting state
  5. 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

Track which optional services failed while still completing the main workflow:
Process data with optional enrichment steps while tracking which enrichments failed:
Send notifications across multiple channels and track which channels failed:

Difference from removeDependencyOnFailure

Understanding when to use ignoreDependencyOnFailure 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
Behavior:
  • 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
Behavior:
  • 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 scenarios

Log 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
Use ignoreDependencyOnFailure instead of removeDependencyOnFailure when you need better observability. The ability to retrieve failure information is valuable for monitoring, debugging, and making informed decisions in the parent processor.
Even though failures are “ignored”, they still represent errors in your system. Always log and monitor ignored failures to ensure optional features are working as expected.

API Reference