@dudousxd/nestjs-durable 0.67.0 → 0.69.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
@@ -1108,7 +1108,8 @@ interface DurableModuleSharedOptions {
1108
1108
  /**
1109
1109
  * How many tasks a worker role's co-located/thin consumer runs concurrently PER SUBSCRIBED QUEUE
1110
1110
  * (BullMQ Worker concurrency — the same limit is applied to every per-name queue the single
1111
- * `runRedisWorker` call starts). Defaults to 1. Raise it so a fanned-out batch (e.g. the N remote
1111
+ * `runRedisWorker` call starts, except the names {@link concurrencyByHandler} overrides).
1112
+ * Defaults to 1. Raise it so a fanned-out batch (e.g. the N remote
1112
1113
  * steps of a `gather`) runs in parallel instead of serially.
1113
1114
  *
1114
1115
  * Pass `'adaptive'` (or `{ mode:'adaptive', ... }`) to let the consumer self-tune its concurrency
@@ -1117,12 +1118,28 @@ interface DurableModuleSharedOptions {
1117
1118
  */
1118
1119
  concurrency?: ConcurrencyOption;
1119
1120
  /**
1120
- * Per-handler concurrency override, keyed by workflow/step NAME. Falls back to {@link concurrency}
1121
- * (then 1). NOT YET WIRED THROUGH: `runRedisWorker` (`@dudousxd/durable-worker`) currently applies
1122
- * one {@link concurrency} limit uniformly across every per-name queue it subscribes to from a
1123
- * single call — reserved here for when per-name concurrency lands there.
1121
+ * Per-handler concurrency override for a worker role's consumer (co-located or thin), keyed by
1122
+ * the exact `@Workflow({ name })` / `@Step(name)` string, namespace included (e.g.
1123
+ * `'agent.opencode.run'`, never the sanitized queue token): that name's queue runs at this limit,
1124
+ * every other queue at {@link concurrency} (then 1). A number or an adaptive config; an
1125
+ * overridden queue runs on its own controller and reports its own status on the heartbeat. A
1126
+ * name this process does not register is ignored, with one warning per name per process.
1127
+ * Ignored for a plain operator.
1124
1128
  */
1125
1129
  concurrencyByHandler?: Record<string, ConcurrencyOption>;
1130
+ /**
1131
+ * BullMQ `lockDuration` (ms) of a worker role's consumer (co-located or thin). Defaults to 5 min.
1132
+ * It also bounds how soon a task held by a worker that died can be redelivered (BullMQ redelivers
1133
+ * only once the lock lapses), so lower it to recover a crashed worker's turn sooner; keep it well
1134
+ * above the longest event-loop stall a healthy turn can cause. Ignored for a plain operator.
1135
+ */
1136
+ lockDuration?: number;
1137
+ /** BullMQ `stalledInterval` (ms) of a worker role's consumer: how often it checks for stalled jobs.
1138
+ * Omitted: BullMQ's default (30 s). Ignored for a plain operator. */
1139
+ stalledInterval?: number;
1140
+ /** BullMQ `maxStalledCount` of a worker role's consumer: how often a job may stall before BullMQ
1141
+ * fails it for good. Omitted: BullMQ's default (1). Ignored for a plain operator. */
1142
+ maxStalledCount?: number;
1126
1143
  /** Timeout for a thin worker's `RunGateway` round-trip over `transport` before it rejects. Defaults
1127
1144
  * to 10_000ms inside `ProxyRunGateway`. Ignored for an operator (bound to `StoreRunGateway`). */
1128
1145
  runGatewayTimeoutMs?: number;
package/dist/index.d.ts CHANGED
@@ -1108,7 +1108,8 @@ interface DurableModuleSharedOptions {
1108
1108
  /**
1109
1109
  * How many tasks a worker role's co-located/thin consumer runs concurrently PER SUBSCRIBED QUEUE
1110
1110
  * (BullMQ Worker concurrency — the same limit is applied to every per-name queue the single
1111
- * `runRedisWorker` call starts). Defaults to 1. Raise it so a fanned-out batch (e.g. the N remote
1111
+ * `runRedisWorker` call starts, except the names {@link concurrencyByHandler} overrides).
1112
+ * Defaults to 1. Raise it so a fanned-out batch (e.g. the N remote
1112
1113
  * steps of a `gather`) runs in parallel instead of serially.
1113
1114
  *
1114
1115
  * Pass `'adaptive'` (or `{ mode:'adaptive', ... }`) to let the consumer self-tune its concurrency
@@ -1117,12 +1118,28 @@ interface DurableModuleSharedOptions {
1117
1118
  */
1118
1119
  concurrency?: ConcurrencyOption;
1119
1120
  /**
1120
- * Per-handler concurrency override, keyed by workflow/step NAME. Falls back to {@link concurrency}
1121
- * (then 1). NOT YET WIRED THROUGH: `runRedisWorker` (`@dudousxd/durable-worker`) currently applies
1122
- * one {@link concurrency} limit uniformly across every per-name queue it subscribes to from a
1123
- * single call — reserved here for when per-name concurrency lands there.
1121
+ * Per-handler concurrency override for a worker role's consumer (co-located or thin), keyed by
1122
+ * the exact `@Workflow({ name })` / `@Step(name)` string, namespace included (e.g.
1123
+ * `'agent.opencode.run'`, never the sanitized queue token): that name's queue runs at this limit,
1124
+ * every other queue at {@link concurrency} (then 1). A number or an adaptive config; an
1125
+ * overridden queue runs on its own controller and reports its own status on the heartbeat. A
1126
+ * name this process does not register is ignored, with one warning per name per process.
1127
+ * Ignored for a plain operator.
1124
1128
  */
1125
1129
  concurrencyByHandler?: Record<string, ConcurrencyOption>;
1130
+ /**
1131
+ * BullMQ `lockDuration` (ms) of a worker role's consumer (co-located or thin). Defaults to 5 min.
1132
+ * It also bounds how soon a task held by a worker that died can be redelivered (BullMQ redelivers
1133
+ * only once the lock lapses), so lower it to recover a crashed worker's turn sooner; keep it well
1134
+ * above the longest event-loop stall a healthy turn can cause. Ignored for a plain operator.
1135
+ */
1136
+ lockDuration?: number;
1137
+ /** BullMQ `stalledInterval` (ms) of a worker role's consumer: how often it checks for stalled jobs.
1138
+ * Omitted: BullMQ's default (30 s). Ignored for a plain operator. */
1139
+ stalledInterval?: number;
1140
+ /** BullMQ `maxStalledCount` of a worker role's consumer: how often a job may stall before BullMQ
1141
+ * fails it for good. Omitted: BullMQ's default (1). Ignored for a plain operator. */
1142
+ maxStalledCount?: number;
1126
1143
  /** Timeout for a thin worker's `RunGateway` round-trip over `transport` before it rejects. Defaults
1127
1144
  * to 10_000ms inside `ProxyRunGateway`. Ignored for an operator (bound to `StoreRunGateway`). */
1128
1145
  runGatewayTimeoutMs?: number;
package/dist/index.js CHANGED
@@ -1481,6 +1481,18 @@ var ThinWorkerBootstrap = class {
1481
1481
  ...options.concurrency !== void 0 ? {
1482
1482
  concurrency: options.concurrency
1483
1483
  } : {},
1484
+ ...options.concurrencyByHandler !== void 0 ? {
1485
+ concurrencyByHandler: options.concurrencyByHandler
1486
+ } : {},
1487
+ ...options.lockDuration !== void 0 ? {
1488
+ lockDuration: options.lockDuration
1489
+ } : {},
1490
+ ...options.stalledInterval !== void 0 ? {
1491
+ stalledInterval: options.stalledInterval
1492
+ } : {},
1493
+ ...options.maxStalledCount !== void 0 ? {
1494
+ maxStalledCount: options.maxStalledCount
1495
+ } : {},
1484
1496
  // Announce the app's schedules (an empty list too) so the control plane adopts, updates and
1485
1497
  // withdraws them: a tenant has no store to fire them from.
1486
1498
  ...await tenantScheduleAnnouncement(options, this.auth.tenantToken)
@@ -1835,6 +1847,18 @@ var InAppWorkerBootstrap = class {
1835
1847
  } : {},
1836
1848
  ...options.concurrency !== void 0 ? {
1837
1849
  concurrency: options.concurrency
1850
+ } : {},
1851
+ ...options.concurrencyByHandler !== void 0 ? {
1852
+ concurrencyByHandler: options.concurrencyByHandler
1853
+ } : {},
1854
+ ...options.lockDuration !== void 0 ? {
1855
+ lockDuration: options.lockDuration
1856
+ } : {},
1857
+ ...options.stalledInterval !== void 0 ? {
1858
+ stalledInterval: options.stalledInterval
1859
+ } : {},
1860
+ ...options.maxStalledCount !== void 0 ? {
1861
+ maxStalledCount: options.maxStalledCount
1838
1862
  } : {}
1839
1863
  });
1840
1864
  this.runners.push(handle);