@dudousxd/nestjs-durable-core 0.96.0 → 0.98.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 CHANGED
@@ -5300,10 +5300,24 @@ var TransportPool = class {
5300
5300
  if (transport.groupHealth) reports.push(await transport.groupHealth(group));
5301
5301
  }
5302
5302
  if (reports.length === 0) return void 0;
5303
+ const shared = reports.find((r) => r.queue !== void 0);
5304
+ const draining = reports.reduce((sum, r) => sum + (r.drainingDepth ?? 0), 0);
5303
5305
  return {
5304
5306
  group,
5305
5307
  depth: reports.reduce((sum, r) => sum + r.depth, 0),
5306
- liveWorkers: reports.flatMap((r) => r.liveWorkers)
5308
+ liveWorkers: reports.flatMap((r) => r.liveWorkers),
5309
+ ...shared?.queue !== void 0 ? {
5310
+ queue: shared.queue
5311
+ } : {},
5312
+ ...shared?.queueDepth !== void 0 ? {
5313
+ queueDepth: shared.queueDepth
5314
+ } : {},
5315
+ ...reports.some((r) => r.depthSampled) ? {
5316
+ depthSampled: true
5317
+ } : {},
5318
+ ...draining > 0 ? {
5319
+ drainingDepth: draining
5320
+ } : {}
5307
5321
  };
5308
5322
  }
5309
5323
  /**
@@ -5374,11 +5388,11 @@ var TransportPool = class {
5374
5388
  * but none is published — both are the "guard disengaged / legacy assume-compatible" case, so the
5375
5389
  * engine's routing guard treats an empty result identically (design §7.7).
5376
5390
  */
5377
- async readWorkerDescriptors(group) {
5391
+ async readWorkerDescriptors(group, opts) {
5378
5392
  const descriptors = [];
5379
5393
  for (const { transport } of this.transports) {
5380
5394
  if (transport.readWorkerDescriptors) {
5381
- descriptors.push(...await transport.readWorkerDescriptors(group));
5395
+ descriptors.push(...await transport.readWorkerDescriptors(group, opts));
5382
5396
  }
5383
5397
  }
5384
5398
  return descriptors;
@@ -14103,11 +14117,14 @@ ${run.workflowVersion}`;
14103
14117
  }
14104
14118
  /** The live descriptors for `token`, reused for {@link workerDescriptorCacheMs}; one read in flight. */
14105
14119
  liveWorkerDescriptors(token, fresh = false) {
14106
- if (this.workerDescriptorCacheMs <= 0) return this.pool.readWorkerDescriptors(token);
14120
+ const opts = fresh ? {
14121
+ fresh: true
14122
+ } : void 0;
14123
+ if (this.workerDescriptorCacheMs <= 0) return this.pool.readWorkerDescriptors(token, opts);
14107
14124
  const now = Date.now();
14108
14125
  const cached = this.descriptorCache.get(token);
14109
14126
  if (!fresh && cached && now - cached.at < this.workerDescriptorCacheMs) return cached.read;
14110
- const read = this.pool.readWorkerDescriptors(token);
14127
+ const read = this.pool.readWorkerDescriptors(token, opts);
14111
14128
  const entry = {
14112
14129
  at: now,
14113
14130
  read