@camunda8/orchestration-cluster-api 9.1.4 → 9.1.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [9.1.5](https://github.com/camunda/orchestration-cluster-api-js/compare/v9.1.4...v9.1.5) (2026-09-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **runtime:** back off job-worker activation retries on transport errors ([#411](https://github.com/camunda/orchestration-cluster-api-js/issues/411)) ([#490](https://github.com/camunda/orchestration-cluster-api-js/issues/490)) ([5244d73](https://github.com/camunda/orchestration-cluster-api-js/commit/5244d7313dea531e6bce2fd7865a13333e9677f7))
7
+
8
+
9
+ ### Reverts
10
+
11
+ * drop unpublished 9.1.5 release metadata ([#491](https://github.com/camunda/orchestration-cluster-api-js/issues/491)) ([70b5724](https://github.com/camunda/orchestration-cluster-api-js/commit/70b57241cf2696e07d0853312dabd73bd4e4c796))
12
+
1
13
  ## [9.1.4](https://github.com/camunda/orchestration-cluster-api-js/compare/v9.1.3...v9.1.4) (2026-07-29)
2
14
 
3
15
 
@@ -111,6 +111,33 @@ var EventualConsistencyTimeoutError = class extends Error {
111
111
  }
112
112
  };
113
113
 
114
+ // src/runtime/pollBackoff.ts
115
+ var DEFAULT_POLL_BACKOFF_MIN_MS = 1e3;
116
+ var DEFAULT_POLL_BACKOFF_MAX_MS = 3e4;
117
+ var MAX_SAFE_TIMEOUT_MS = 2147483647;
118
+ function computePollBackoffMs(attempt, opts) {
119
+ const rng = opts.rng ?? Math.random;
120
+ const min = Number.isFinite(opts.minMs) ? Math.min(MAX_SAFE_TIMEOUT_MS, Math.max(0, Math.floor(opts.minMs))) : 0;
121
+ const max = Number.isFinite(opts.maxMs) ? Math.min(MAX_SAFE_TIMEOUT_MS, Math.max(min, Math.floor(opts.maxMs))) : min;
122
+ const safeAttempt = Number.isFinite(attempt) ? Math.max(1, Math.floor(attempt)) : 1;
123
+ const exponent = Math.min(safeAttempt - 1, 53);
124
+ const cap = Math.min(max, min * 2 ** exponent);
125
+ const half = cap / 2;
126
+ const r = rng();
127
+ const jitter = Number.isFinite(r) ? Math.min(1, Math.max(0, r)) : 0;
128
+ return Math.round(half + jitter * half);
129
+ }
130
+ function nextActivationRetryDelayMs(attempt, cfg, rng) {
131
+ if (cfg.pollBackoffMinMs > 0) {
132
+ return computePollBackoffMs(attempt, {
133
+ minMs: cfg.pollBackoffMinMs,
134
+ maxMs: cfg.pollBackoffMaxMs,
135
+ rng
136
+ });
137
+ }
138
+ return Number.isFinite(cfg.pollIntervalMs) ? Math.max(0, Math.round(cfg.pollIntervalMs)) : 0;
139
+ }
140
+
114
141
  // src/runtime/jobWorker.ts
115
142
  var JobActionReceipt = "JOB_ACTION_RECEIPT";
116
143
  var _workerCounter = 0;
@@ -126,11 +153,15 @@ var JobWorker = class {
126
153
  _pollTimer = null;
127
154
  _inFlightActivation = null;
128
155
  // CancelablePromise-like
156
+ /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
157
+ _consecutiveActivationErrors = 0;
129
158
  _log;
130
159
  constructor(client2, cfg) {
131
160
  this._client = client2;
132
161
  this._cfg = {
133
162
  pollIntervalMs: 1,
163
+ pollBackoffMinMs: DEFAULT_POLL_BACKOFF_MIN_MS,
164
+ pollBackoffMaxMs: DEFAULT_POLL_BACKOFF_MAX_MS,
134
165
  autoStart: true,
135
166
  validateSchemas: false,
136
167
  maxParallelJobs: 10,
@@ -257,6 +288,7 @@ var JobWorker = class {
257
288
  this._inFlightActivation = this._client.activateJobs(body);
258
289
  const activation = await this._inFlightActivation;
259
290
  this._inFlightActivation = null;
291
+ this._consecutiveActivationErrors = 0;
260
292
  result = activation?.jobs || [];
261
293
  this._log.debug(() => ["activation.response", { jobs: result.length }]);
262
294
  } catch (e) {
@@ -264,10 +296,21 @@ var JobWorker = class {
264
296
  if (this._stopped) return;
265
297
  if (e?.name === "CancelSdkError") {
266
298
  this._log.debug("activation.cancelled");
267
- } else {
268
- this._log.error("activation.error", e);
299
+ this._scheduleNext(this._cfg.pollIntervalMs);
300
+ return;
269
301
  }
270
- this._scheduleNext(this._cfg.pollIntervalMs);
302
+ this._consecutiveActivationErrors += 1;
303
+ const delayMs = nextActivationRetryDelayMs(this._consecutiveActivationErrors, {
304
+ pollIntervalMs: this._cfg.pollIntervalMs,
305
+ pollBackoffMinMs: this._cfg.pollBackoffMinMs,
306
+ pollBackoffMaxMs: this._cfg.pollBackoffMaxMs
307
+ });
308
+ this._log.error("activation.error", e);
309
+ this._log.debug(() => [
310
+ "activation.retry",
311
+ { attempt: this._consecutiveActivationErrors, retryInMs: delayMs }
312
+ ]);
313
+ this._scheduleNext(delayMs);
271
314
  return;
272
315
  }
273
316
  if (!result || result.length === 0) {
@@ -4409,7 +4452,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
4409
4452
  }
4410
4453
 
4411
4454
  // src/runtime/version.ts
4412
- var packageVersion = "9.1.4";
4455
+ var packageVersion = "9.1.5";
4413
4456
 
4414
4457
  // src/runtime/supportLogger.ts
4415
4458
  var NoopSupportLogger = class {
@@ -5513,6 +5556,8 @@ var ThreadedJobWorker = class {
5513
5556
  _stopped = false;
5514
5557
  _pollTimer = null;
5515
5558
  _inFlightActivation = null;
5559
+ /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
5560
+ _consecutiveActivationErrors = 0;
5516
5561
  _log;
5517
5562
  _jobQueue = [];
5518
5563
  constructor(client2, pool, cfg) {
@@ -5520,6 +5565,8 @@ var ThreadedJobWorker = class {
5520
5565
  this._pool = pool;
5521
5566
  this._cfg = {
5522
5567
  pollIntervalMs: 1,
5568
+ pollBackoffMinMs: DEFAULT_POLL_BACKOFF_MIN_MS,
5569
+ pollBackoffMaxMs: DEFAULT_POLL_BACKOFF_MAX_MS,
5523
5570
  autoStart: true,
5524
5571
  validateSchemas: false,
5525
5572
  maxParallelJobs: 10,
@@ -5733,6 +5780,7 @@ var ThreadedJobWorker = class {
5733
5780
  this._inFlightActivation = this._client.activateJobs(body);
5734
5781
  const activation = await this._inFlightActivation;
5735
5782
  this._inFlightActivation = null;
5783
+ this._consecutiveActivationErrors = 0;
5736
5784
  result = activation?.jobs || [];
5737
5785
  this._log.debug(() => ["activation.response", { jobs: result.length }]);
5738
5786
  } catch (e) {
@@ -5740,10 +5788,21 @@ var ThreadedJobWorker = class {
5740
5788
  if (this._stopped) return;
5741
5789
  if (e?.name === "CancelSdkError") {
5742
5790
  this._log.debug("activation.cancelled");
5743
- } else {
5744
- this._log.error("activation.error", e);
5791
+ this._scheduleNext(this._cfg.pollIntervalMs);
5792
+ return;
5745
5793
  }
5746
- this._scheduleNext(this._cfg.pollIntervalMs);
5794
+ this._consecutiveActivationErrors += 1;
5795
+ const delayMs = nextActivationRetryDelayMs(this._consecutiveActivationErrors, {
5796
+ pollIntervalMs: this._cfg.pollIntervalMs,
5797
+ pollBackoffMinMs: this._cfg.pollBackoffMinMs,
5798
+ pollBackoffMaxMs: this._cfg.pollBackoffMaxMs
5799
+ });
5800
+ this._log.error("activation.error", e);
5801
+ this._log.debug(() => [
5802
+ "activation.retry",
5803
+ { attempt: this._consecutiveActivationErrors, retryInMs: delayMs }
5804
+ ]);
5805
+ this._scheduleNext(delayMs);
5747
5806
  return;
5748
5807
  }
5749
5808
  if (!result || result.length === 0) {
@@ -6386,7 +6445,7 @@ var CamundaClient = class {
6386
6445
  _schemasPromise = null;
6387
6446
  _loadSchemas() {
6388
6447
  if (!this._schemasPromise) {
6389
- this._schemasPromise = import("./zod.gen-I6G7OTVZ.js");
6448
+ this._schemasPromise = import("./zod.gen-UYZKIAHB.js");
6390
6449
  }
6391
6450
  return this._schemasPromise;
6392
6451
  }
@@ -16719,4 +16778,4 @@ export {
16719
16778
  withTimeoutTE,
16720
16779
  eventuallyTE
16721
16780
  };
16722
- //# sourceMappingURL=chunk-4NRTES5E.js.map
16781
+ //# sourceMappingURL=chunk-JV6P7LF3.js.map