@dudousxd/nestjs-durable-core 0.56.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +40 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1493,6 +1493,22 @@ function createWorkflowCtx(host, runId, compensations, workflow = "", searchAttr
|
|
|
1493
1493
|
runId,
|
|
1494
1494
|
seq: current
|
|
1495
1495
|
});
|
|
1496
|
+
const buffered = await store.takeBufferedSignal(`child:${id}`);
|
|
1497
|
+
if (buffered) {
|
|
1498
|
+
await store.removeSignalWaiter({
|
|
1499
|
+
token: `child:${id}`,
|
|
1500
|
+
runId,
|
|
1501
|
+
seq: current
|
|
1502
|
+
});
|
|
1503
|
+
await writeCheckpoint(instantCheckpoint({
|
|
1504
|
+
runId,
|
|
1505
|
+
seq: current,
|
|
1506
|
+
name: `signal:child:${id}`,
|
|
1507
|
+
kind: "signal",
|
|
1508
|
+
output: buffered.payload
|
|
1509
|
+
}));
|
|
1510
|
+
return unwrapCompletion(buffered.payload, `child "${id}"`);
|
|
1511
|
+
}
|
|
1496
1512
|
if (!await store.getRun(id)) host.startChild(workflowName(workflow2), input, id, priority);
|
|
1497
1513
|
if (!existing) {
|
|
1498
1514
|
await writeCheckpoint(instantCheckpoint({
|
|
@@ -2713,6 +2729,30 @@ var WorkflowEngine = class {
|
|
|
2713
2729
|
async requeue(runId) {
|
|
2714
2730
|
const run = await this.store.getRun(runId);
|
|
2715
2731
|
if (!run) return null;
|
|
2732
|
+
if (run.status === "failed" || run.status === "dead") {
|
|
2733
|
+
const isFailureCompletion = /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && v.ok === false, "isFailureCompletion");
|
|
2734
|
+
for (const cp of await this.store.listCheckpoints(runId)) {
|
|
2735
|
+
if (cp.status === "failed") {
|
|
2736
|
+
await this.store.saveCheckpoint({
|
|
2737
|
+
...cp,
|
|
2738
|
+
attempts: 0,
|
|
2739
|
+
wakeAt: this.clock(),
|
|
2740
|
+
...cp.error ? {
|
|
2741
|
+
error: {
|
|
2742
|
+
...cp.error,
|
|
2743
|
+
retryable: true
|
|
2744
|
+
}
|
|
2745
|
+
} : {}
|
|
2746
|
+
});
|
|
2747
|
+
} else if (cp.kind === "signal" && cp.name.startsWith("signal:child:") && cp.status === "completed" && isFailureCompletion(cp.output)) {
|
|
2748
|
+
await this.store.saveCheckpoint({
|
|
2749
|
+
...cp,
|
|
2750
|
+
status: "running",
|
|
2751
|
+
output: void 0
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2716
2756
|
await this.store.releaseRunLock(runId);
|
|
2717
2757
|
await this.store.updateRun(runId, {
|
|
2718
2758
|
status: "pending",
|