@dudousxd/nestjs-durable 0.66.0 → 0.68.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
@@ -1123,6 +1123,19 @@ interface DurableModuleSharedOptions {
1123
1123
  * single call — reserved here for when per-name concurrency lands there.
1124
1124
  */
1125
1125
  concurrencyByHandler?: Record<string, ConcurrencyOption>;
1126
+ /**
1127
+ * BullMQ `lockDuration` (ms) of a worker role's consumer (co-located or thin). Defaults to 5 min.
1128
+ * It also bounds how soon a task held by a worker that died can be redelivered (BullMQ redelivers
1129
+ * only once the lock lapses), so lower it to recover a crashed worker's turn sooner; keep it well
1130
+ * above the longest event-loop stall a healthy turn can cause. Ignored for a plain operator.
1131
+ */
1132
+ lockDuration?: number;
1133
+ /** BullMQ `stalledInterval` (ms) of a worker role's consumer: how often it checks for stalled jobs.
1134
+ * Omitted: BullMQ's default (30 s). Ignored for a plain operator. */
1135
+ stalledInterval?: number;
1136
+ /** BullMQ `maxStalledCount` of a worker role's consumer: how often a job may stall before BullMQ
1137
+ * fails it for good. Omitted: BullMQ's default (1). Ignored for a plain operator. */
1138
+ maxStalledCount?: number;
1126
1139
  /** Timeout for a thin worker's `RunGateway` round-trip over `transport` before it rejects. Defaults
1127
1140
  * to 10_000ms inside `ProxyRunGateway`. Ignored for an operator (bound to `StoreRunGateway`). */
1128
1141
  runGatewayTimeoutMs?: number;
package/dist/index.d.ts CHANGED
@@ -1123,6 +1123,19 @@ interface DurableModuleSharedOptions {
1123
1123
  * single call — reserved here for when per-name concurrency lands there.
1124
1124
  */
1125
1125
  concurrencyByHandler?: Record<string, ConcurrencyOption>;
1126
+ /**
1127
+ * BullMQ `lockDuration` (ms) of a worker role's consumer (co-located or thin). Defaults to 5 min.
1128
+ * It also bounds how soon a task held by a worker that died can be redelivered (BullMQ redelivers
1129
+ * only once the lock lapses), so lower it to recover a crashed worker's turn sooner; keep it well
1130
+ * above the longest event-loop stall a healthy turn can cause. Ignored for a plain operator.
1131
+ */
1132
+ lockDuration?: number;
1133
+ /** BullMQ `stalledInterval` (ms) of a worker role's consumer: how often it checks for stalled jobs.
1134
+ * Omitted: BullMQ's default (30 s). Ignored for a plain operator. */
1135
+ stalledInterval?: number;
1136
+ /** BullMQ `maxStalledCount` of a worker role's consumer: how often a job may stall before BullMQ
1137
+ * fails it for good. Omitted: BullMQ's default (1). Ignored for a plain operator. */
1138
+ maxStalledCount?: number;
1126
1139
  /** Timeout for a thin worker's `RunGateway` round-trip over `transport` before it rejects. Defaults
1127
1140
  * to 10_000ms inside `ProxyRunGateway`. Ignored for an operator (bound to `StoreRunGateway`). */
1128
1141
  runGatewayTimeoutMs?: number;
package/dist/index.js CHANGED
@@ -1481,6 +1481,15 @@ var ThinWorkerBootstrap = class {
1481
1481
  ...options.concurrency !== void 0 ? {
1482
1482
  concurrency: options.concurrency
1483
1483
  } : {},
1484
+ ...options.lockDuration !== void 0 ? {
1485
+ lockDuration: options.lockDuration
1486
+ } : {},
1487
+ ...options.stalledInterval !== void 0 ? {
1488
+ stalledInterval: options.stalledInterval
1489
+ } : {},
1490
+ ...options.maxStalledCount !== void 0 ? {
1491
+ maxStalledCount: options.maxStalledCount
1492
+ } : {},
1484
1493
  // Announce the app's schedules (an empty list too) so the control plane adopts, updates and
1485
1494
  // withdraws them: a tenant has no store to fire them from.
1486
1495
  ...await tenantScheduleAnnouncement(options, this.auth.tenantToken)
@@ -1578,7 +1587,12 @@ function thinWorkerProviders() {
1578
1587
  // optional `@dudousxd/durable-worker` peer, so an operator that never runs a worker must not
1579
1588
  // reach this branch at all.
1580
1589
  useFactory: /* @__PURE__ */ __name((options) => isPureThinWorker(options) ? createWorkerRuntime({
1581
- workflowGroup: options.partition ?? ""
1590
+ workflowGroup: options.partition ?? "",
1591
+ // The worker unwinds a failed turn's `localStep` undos itself, so it takes the
1592
+ // module's `compensationRetries` as the engine does.
1593
+ ...options.compensationRetries !== void 0 ? {
1594
+ compensationRetries: options.compensationRetries
1595
+ } : {}
1582
1596
  }) : null, "useFactory"),
1583
1597
  inject: [
1584
1598
  DURABLE_OPTIONS_CANONICAL
@@ -1830,6 +1844,15 @@ var InAppWorkerBootstrap = class {
1830
1844
  } : {},
1831
1845
  ...options.concurrency !== void 0 ? {
1832
1846
  concurrency: options.concurrency
1847
+ } : {},
1848
+ ...options.lockDuration !== void 0 ? {
1849
+ lockDuration: options.lockDuration
1850
+ } : {},
1851
+ ...options.stalledInterval !== void 0 ? {
1852
+ stalledInterval: options.stalledInterval
1853
+ } : {},
1854
+ ...options.maxStalledCount !== void 0 ? {
1855
+ maxStalledCount: options.maxStalledCount
1833
1856
  } : {}
1834
1857
  });
1835
1858
  this.runners.push(handle);
@@ -1879,7 +1902,12 @@ function inAppWorkerProviders() {
1879
1902
  // optional `@dudousxd/durable-worker` peer, so an operator that never runs a worker must not
1880
1903
  // reach this branch at all.
1881
1904
  useFactory: /* @__PURE__ */ __name((options) => isCoLocatedWorker(options) ? createWorkerRuntime({
1882
- workflowGroup: options.partition ?? ""
1905
+ workflowGroup: options.partition ?? "",
1906
+ // The worker unwinds a failed turn's `localStep` undos itself, so it takes the
1907
+ // module's `compensationRetries` as the engine does.
1908
+ ...options.compensationRetries !== void 0 ? {
1909
+ compensationRetries: options.compensationRetries
1910
+ } : {}
1883
1911
  }) : null, "useFactory"),
1884
1912
  inject: [
1885
1913
  DURABLE_OPTIONS_CANONICAL3