You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some situations, you may have a parent job and need to ignore when one of its children fail.
4
+
5
+
The pattern to solve this requirement consists on using the **ignoreDependencyOnFailure** option. This option will make sure that when a job fails, the dependency is ignored from the parent, so the parent will complete without waiting for the failed children.
6
+
7
+
```typescript
8
+
const flow =newFlowProducer({ connection });
9
+
10
+
const originalTree =awaitflow.add({
11
+
name: 'root-job',
12
+
queueName: 'topQueueName',
13
+
data: {},
14
+
children: [
15
+
{
16
+
name,
17
+
data: { idx: 0, foo: 'bar' },
18
+
queueName: 'childrenQueueName',
19
+
opts: { ignoreDependencyOnFailure: true },
20
+
children: [
21
+
{
22
+
name,
23
+
data: { idx: 1, foo: 'bah' },
24
+
queueName: 'grandChildrenQueueName',
25
+
},
26
+
{
27
+
name,
28
+
data: { idx: 2, foo: 'baz' },
29
+
queueName: 'grandChildrenQueueName',
30
+
},
31
+
],
32
+
},
33
+
{
34
+
name,
35
+
data: { idx: 3, foo: 'foo' },
36
+
queueName: 'childrenQueueName',
37
+
},
38
+
],
39
+
});
40
+
```
41
+
42
+
{% hint style="info" %}
43
+
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.
44
+
{% endhint %}
45
+
46
+
Failed children using this option can be retrieved by **getFailedChildrenValues** method:
Copy file name to clipboardexpand all lines: docs/gitbook/guide/flows/remove-dependency.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Remove Dependency
2
2
3
-
In some situations, you may have a parent job and need to ignore when one of its children fail.
3
+
In some situations, you may have a parent job and need to remove the relationship when one of its children fail.
4
4
5
5
The pattern to solve this requirement consists on using the **removeDependencyOnFailure** option. This option will make sure that when a job fails, the dependency is removed from the parent, so the parent will complete without waiting for the failed children.
0 commit comments