@dudousxd/nestjs-durable-core 0.57.0 → 0.58.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 +24 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2817,7 +2817,10 @@ var WorkflowEngine = class {
|
|
|
2817
2817
|
* inline — or null if the run is unknown. The dashboard "retry" goes through here so it can't block
|
|
2818
2818
|
* the HTTP request on workflow execution.
|
|
2819
2819
|
*/
|
|
2820
|
-
async requeue(runId) {
|
|
2820
|
+
async requeue(runId, _seen) {
|
|
2821
|
+
const seen = _seen ?? /* @__PURE__ */ new Set();
|
|
2822
|
+
if (seen.has(runId)) return null;
|
|
2823
|
+
seen.add(runId);
|
|
2821
2824
|
const run = await this.store.getRun(runId);
|
|
2822
2825
|
if (!run) return null;
|
|
2823
2826
|
if (run.status === "failed" || run.status === "dead") {
|
|
@@ -2841,12 +2844,28 @@ var WorkflowEngine = class {
|
|
|
2841
2844
|
status: "running",
|
|
2842
2845
|
output: void 0
|
|
2843
2846
|
});
|
|
2847
|
+
const childId = cp.name.slice("signal:child:".length);
|
|
2848
|
+
const parked = [];
|
|
2849
|
+
for (; ; ) {
|
|
2850
|
+
const buffered = await this.store.takeBufferedSignal(`child:${childId}`);
|
|
2851
|
+
if (!buffered) break;
|
|
2852
|
+
parked.push(buffered.payload);
|
|
2853
|
+
}
|
|
2854
|
+
for (const payload of parked) await this.store.bufferSignal(`child:${childId}`, payload);
|
|
2855
|
+
const bufferedSuccess = parked.some((payload) => typeof payload === "object" && payload !== null && payload.ok === true);
|
|
2856
|
+
if (!bufferedSuccess) {
|
|
2857
|
+
const child = await this.store.getRun(childId);
|
|
2858
|
+
if (child && (child.status === "failed" || child.status === "dead")) {
|
|
2859
|
+
await this.requeue(childId, seen);
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2844
2862
|
}
|
|
2845
2863
|
}
|
|
2846
2864
|
}
|
|
2847
2865
|
await this.store.releaseRunLock(runId);
|
|
2848
2866
|
await this.store.updateRun(runId, {
|
|
2849
2867
|
status: "pending",
|
|
2868
|
+
error: void 0,
|
|
2850
2869
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2851
2870
|
});
|
|
2852
2871
|
await this.runDispatcher.dispatch(runId);
|
|
@@ -3166,6 +3185,10 @@ var WorkflowEngine = class {
|
|
|
3166
3185
|
*/
|
|
3167
3186
|
notifyParent(runId, completion) {
|
|
3168
3187
|
void this.signal(`child:${runId}`, completion).catch(() => void 0);
|
|
3188
|
+
const at = runId.lastIndexOf("~retry~");
|
|
3189
|
+
if (at !== -1 && completion.ok) {
|
|
3190
|
+
void this.signal(`child:${runId.slice(0, at)}`, completion).catch(() => void 0);
|
|
3191
|
+
}
|
|
3169
3192
|
}
|
|
3170
3193
|
/**
|
|
3171
3194
|
* Deferred child start shared by the in-process ctx host and the remote `startChild` command.
|