@dudousxd/nestjs-durable-core 0.96.0 → 0.97.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.d.cts CHANGED
@@ -3121,9 +3121,12 @@ interface Transport {
3121
3121
  * broker transports that carry the two-tier descriptor advertisement (BullMQ) implement it; a pure
3122
3122
  * in-process transport returns nothing, so the engine's routing guard stays disengaged (legacy
3123
3123
  * assume-compatible, design §7.7). The engine feeds these into {@link planDispatch} to decide whether
3124
- * a run can dispatch to `group` or must park `blocked`.
3124
+ * a run can dispatch to `group` or must park `blocked`. A transport may reuse a recent read of its
3125
+ * registry; `opts.fresh` asks it to read again (the engine does before it parks a run `blocked`).
3125
3126
  */
3126
- readWorkerDescriptors?(group: string): Promise<WorkerDescriptor[]>;
3127
+ readWorkerDescriptors?(group: string, opts?: {
3128
+ fresh?: boolean | undefined;
3129
+ }): Promise<WorkerDescriptor[]>;
3127
3130
  /**
3128
3131
  * Every live {@link WorkerDescriptor} in the deployment, across all groups — the read behind
3129
3132
  * {@link WorkflowEngine.announcedWorkflows}. Optional, same as {@link readWorkerDescriptors}: a
package/dist/index.d.ts CHANGED
@@ -3121,9 +3121,12 @@ interface Transport {
3121
3121
  * broker transports that carry the two-tier descriptor advertisement (BullMQ) implement it; a pure
3122
3122
  * in-process transport returns nothing, so the engine's routing guard stays disengaged (legacy
3123
3123
  * assume-compatible, design §7.7). The engine feeds these into {@link planDispatch} to decide whether
3124
- * a run can dispatch to `group` or must park `blocked`.
3124
+ * a run can dispatch to `group` or must park `blocked`. A transport may reuse a recent read of its
3125
+ * registry; `opts.fresh` asks it to read again (the engine does before it parks a run `blocked`).
3125
3126
  */
3126
- readWorkerDescriptors?(group: string): Promise<WorkerDescriptor[]>;
3127
+ readWorkerDescriptors?(group: string, opts?: {
3128
+ fresh?: boolean | undefined;
3129
+ }): Promise<WorkerDescriptor[]>;
3127
3130
  /**
3128
3131
  * Every live {@link WorkerDescriptor} in the deployment, across all groups — the read behind
3129
3132
  * {@link WorkflowEngine.announcedWorkflows}. Optional, same as {@link readWorkerDescriptors}: a
package/dist/index.js CHANGED
@@ -5081,11 +5081,11 @@ var TransportPool = class {
5081
5081
  * but none is published — both are the "guard disengaged / legacy assume-compatible" case, so the
5082
5082
  * engine's routing guard treats an empty result identically (design §7.7).
5083
5083
  */
5084
- async readWorkerDescriptors(group) {
5084
+ async readWorkerDescriptors(group, opts) {
5085
5085
  const descriptors = [];
5086
5086
  for (const { transport } of this.transports) {
5087
5087
  if (transport.readWorkerDescriptors) {
5088
- descriptors.push(...await transport.readWorkerDescriptors(group));
5088
+ descriptors.push(...await transport.readWorkerDescriptors(group, opts));
5089
5089
  }
5090
5090
  }
5091
5091
  return descriptors;
@@ -13810,11 +13810,14 @@ ${run.workflowVersion}`;
13810
13810
  }
13811
13811
  /** The live descriptors for `token`, reused for {@link workerDescriptorCacheMs}; one read in flight. */
13812
13812
  liveWorkerDescriptors(token, fresh = false) {
13813
- if (this.workerDescriptorCacheMs <= 0) return this.pool.readWorkerDescriptors(token);
13813
+ const opts = fresh ? {
13814
+ fresh: true
13815
+ } : void 0;
13816
+ if (this.workerDescriptorCacheMs <= 0) return this.pool.readWorkerDescriptors(token, opts);
13814
13817
  const now = Date.now();
13815
13818
  const cached = this.descriptorCache.get(token);
13816
13819
  if (!fresh && cached && now - cached.at < this.workerDescriptorCacheMs) return cached.read;
13817
- const read = this.pool.readWorkerDescriptors(token);
13820
+ const read = this.pool.readWorkerDescriptors(token, opts);
13818
13821
  const entry = {
13819
13822
  at: now,
13820
13823
  read