@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.cjs CHANGED
@@ -5186,7 +5186,7 @@ var WorkflowEngine = class {
5186
5186
  if (this.store.listOrphanedRuns) {
5187
5187
  return shuffle(await this.store.listOrphanedRuns(nowMs, RECOVERY_BATCH, this.namespace));
5188
5188
  }
5189
- return shuffle((await this.store.listIncompleteRuns(this.namespace)).filter((run) => run.lockedUntil == null || run.lockedUntil <= nowMs));
5189
+ 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));
5190
5190
  }
5191
5191
  /**
5192
5192
  * The remote step this run dispatched and is still awaiting a result for, if any — the signature
@@ -7928,7 +7928,7 @@ ${run.workflowVersion}`;
7928
7928
  updatedAt: /* @__PURE__ */ new Date()
7929
7929
  });
7930
7930
  if (!applied) {
7931
- await this.store.releaseRunLock(run.id);
7931
+ await this.releaseLeaseBestEffort(run.id);
7932
7932
  return this.echoCurrentStatus(run.id);
7933
7933
  }
7934
7934
  this.emit({
@@ -7940,7 +7940,7 @@ ${run.workflowVersion}`;
7940
7940
  requires: blocked.requires,
7941
7941
  diagnostics: blocked.diagnostics
7942
7942
  });
7943
- await this.store.releaseRunLock(run.id);
7943
+ await this.releaseLeaseBestEffort(run.id);
7944
7944
  return {
7945
7945
  runId: run.id,
7946
7946
  status: "blocked",