Fail Parent
Make parents fail is any of its children fails
Key Points
Example
import { FlowProducer } from 'bullmq';
const flow = new FlowProducer({ connection });
const originalTree = await flow.add({
name: 'root-job',
queueName: 'topQueueName',
data: {},
children: [
{
name: 'child-job',
data: { idx: 0, foo: 'bar' },
queueName: 'childrenQueueName',
// This child will fail its parent if it fails
opts: { failParentOnFailure: true },
children: [
{
name,
data: { idx: 1, foo: 'bah' },
queueName: 'grandChildrenQueueName',
// This grandchild will fail its parent if it fails
opts: { failParentOnFailure: true },
},
{
name,
data: { idx: 2, foo: 'baz' },
queueName: 'grandChildrenQueueName',
// No failParentOnFailure; its failure won't affect the parent
},
],
},
{
name,
data: { idx: 3, foo: 'foo' },
queueName: 'childrenQueueName',
// No failParentOnFailure; its failure won't affect the parent
},
],
});How it Works
Use Case
Read more:
Last updated
Was this helpful?