@dudousxd/nestjs-durable-core 0.71.0 → 0.71.1
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 +21 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3657,9 +3657,14 @@ var WorkflowEngine = class {
|
|
|
3657
3657
|
async recoverIncomplete(nowMs = this.clock()) {
|
|
3658
3658
|
if (this.draining) return [];
|
|
3659
3659
|
const results = [];
|
|
3660
|
-
for (const
|
|
3661
|
-
const acquired = await this.store.tryLockRun(
|
|
3660
|
+
for (const listed of await this.store.listIncompleteRuns(this.namespace)) {
|
|
3661
|
+
const acquired = await this.store.tryLockRun(listed.id, this.instanceId, nowMs + this.leaseMs, nowMs);
|
|
3662
3662
|
if (!acquired) continue;
|
|
3663
|
+
const run = await this.store.getRun(listed.id);
|
|
3664
|
+
if (!run || run.status !== "running" && run.status !== "cancelling") {
|
|
3665
|
+
await this.store.releaseRunLock(listed.id);
|
|
3666
|
+
continue;
|
|
3667
|
+
}
|
|
3663
3668
|
if (run.status === "running") {
|
|
3664
3669
|
const dispatched = await this.inFlightRemoteStep(run.id);
|
|
3665
3670
|
if (dispatched) {
|
|
@@ -5519,16 +5524,16 @@ var WorkflowEngine = class {
|
|
|
5519
5524
|
try {
|
|
5520
5525
|
const output = await runInWorkflowCtx(ctx, () => fn(ctx, run.input));
|
|
5521
5526
|
if (this.cancelRequested.has(run.id)) {
|
|
5522
|
-
return this.compensateAndCancel(run, compensations, replay);
|
|
5527
|
+
return await this.compensateAndCancel(run, compensations, replay);
|
|
5523
5528
|
}
|
|
5524
|
-
return this.settleRun(run, {
|
|
5529
|
+
return await this.settleRun(run, {
|
|
5525
5530
|
kind: "completed",
|
|
5526
5531
|
output
|
|
5527
5532
|
});
|
|
5528
5533
|
} catch (err) {
|
|
5529
5534
|
if (err instanceof ContinueAsNew) {
|
|
5530
5535
|
if (this.cancelRequested.has(run.id)) {
|
|
5531
|
-
return this.compensateAndCancel(run, compensations, replay);
|
|
5536
|
+
return await this.compensateAndCancel(run, compensations, replay);
|
|
5532
5537
|
}
|
|
5533
5538
|
await this.store.updateRun(run.id, {
|
|
5534
5539
|
status: "completed",
|
|
@@ -5555,35 +5560,35 @@ var WorkflowEngine = class {
|
|
|
5555
5560
|
}
|
|
5556
5561
|
if (err instanceof WorkflowBlocked) {
|
|
5557
5562
|
if (this.cancelRequested.has(run.id)) {
|
|
5558
|
-
return this.compensateAndCancel(run, compensations, replay);
|
|
5563
|
+
return await this.compensateAndCancel(run, compensations, replay);
|
|
5559
5564
|
}
|
|
5560
|
-
return this.settleRun(run, {
|
|
5565
|
+
return await this.settleRun(run, {
|
|
5561
5566
|
kind: "blocked",
|
|
5562
5567
|
blocked: err.plan
|
|
5563
5568
|
});
|
|
5564
5569
|
}
|
|
5565
5570
|
if (err instanceof WorkflowSuspended) {
|
|
5566
5571
|
if (this.cancelRequested.has(run.id)) {
|
|
5567
|
-
return this.compensateAndCancel(run, compensations, replay);
|
|
5572
|
+
return await this.compensateAndCancel(run, compensations, replay);
|
|
5568
5573
|
}
|
|
5569
|
-
return this.settleRun(run, {
|
|
5574
|
+
return await this.settleRun(run, {
|
|
5570
5575
|
kind: "suspended",
|
|
5571
5576
|
wakeAt: err.wakeAt
|
|
5572
5577
|
});
|
|
5573
5578
|
}
|
|
5574
5579
|
if (this.cancelRequested.has(run.id)) {
|
|
5575
|
-
return this.compensateAndCancel(run, compensations, replay);
|
|
5580
|
+
return await this.compensateAndCancel(run, compensations, replay);
|
|
5576
5581
|
}
|
|
5577
5582
|
const error2 = {
|
|
5578
5583
|
message: err instanceof Error ? err.message : String(err),
|
|
5579
5584
|
stack: err instanceof Error ? err.stack : void 0
|
|
5580
5585
|
};
|
|
5581
5586
|
const pending = await this.unwindCompensations(run, compensations, replay);
|
|
5582
|
-
if (pending) return this.settleRun(run, {
|
|
5587
|
+
if (pending) return await this.settleRun(run, {
|
|
5583
5588
|
kind: "suspended",
|
|
5584
5589
|
wakeAt: pending.wakeAt
|
|
5585
5590
|
});
|
|
5586
|
-
return this.settleRun(run, {
|
|
5591
|
+
return await this.settleRun(run, {
|
|
5587
5592
|
kind: "failed",
|
|
5588
5593
|
error: error2
|
|
5589
5594
|
});
|
|
@@ -5997,7 +6002,10 @@ var WorkflowEngine = class {
|
|
|
5997
6002
|
}
|
|
5998
6003
|
async callRemote(runId, seq, step, input, queue, transport, replay, admission, routing) {
|
|
5999
6004
|
const group = stepGroup(step, routing?.namespace);
|
|
6000
|
-
|
|
6005
|
+
let existing = replay?.get(seq) ?? await this.store.getCheckpoint(runId, seq);
|
|
6006
|
+
if (existing?.status === "pending" && replay?.has(seq)) {
|
|
6007
|
+
existing = await this.store.getCheckpoint(runId, seq) ?? existing;
|
|
6008
|
+
}
|
|
6001
6009
|
if (existing && existing.name !== step.name) {
|
|
6002
6010
|
throw new NonDeterminismError(runId, seq, step.name, existing.name);
|
|
6003
6011
|
}
|