@dudousxd/nestjs-durable-core 0.80.0 → 0.80.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.js CHANGED
@@ -4993,7 +4993,7 @@ var WorkflowEngine = class {
4993
4993
  if (this.store.listOrphanedRuns) {
4994
4994
  return shuffle(await this.store.listOrphanedRuns(nowMs, RECOVERY_BATCH, this.namespace));
4995
4995
  }
4996
- return shuffle((await this.store.listIncompleteRuns(this.namespace)).filter((run) => run.lockedUntil == null || run.lockedUntil <= nowMs));
4996
+ return shuffle((await this.store.listIncompleteRuns(this.namespace)).filter((run) => run.lockedUntil == null || run.lockedUntil <= nowMs).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime()).slice(0, RECOVERY_BATCH));
4997
4997
  }
4998
4998
  /**
4999
4999
  * The remote step this run dispatched and is still awaiting a result for, if any — the signature
@@ -7735,7 +7735,7 @@ ${run.workflowVersion}`;
7735
7735
  updatedAt: /* @__PURE__ */ new Date()
7736
7736
  });
7737
7737
  if (!applied) {
7738
- await this.store.releaseRunLock(run.id);
7738
+ await this.releaseLeaseBestEffort(run.id);
7739
7739
  return this.echoCurrentStatus(run.id);
7740
7740
  }
7741
7741
  this.emit({
@@ -7747,7 +7747,7 @@ ${run.workflowVersion}`;
7747
7747
  requires: blocked.requires,
7748
7748
  diagnostics: blocked.diagnostics
7749
7749
  });
7750
- await this.store.releaseRunLock(run.id);
7750
+ await this.releaseLeaseBestEffort(run.id);
7751
7751
  return {
7752
7752
  runId: run.id,
7753
7753
  status: "blocked",