@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/dist/fp/index.cjs CHANGED
@@ -3182,7 +3182,7 @@ var init_zod_gen = __esm({
3182
3182
  import_zod4.z.object({
3183
3183
  operationReference: import_zod4.z.optional(zOperationReference),
3184
3184
  deleteHistory: import_zod4.z.optional(import_zod4.z.boolean().register(import_zod4.z.globalRegistry, {
3185
- description: "Indicates if the historic data of a process resource should be deleted via a\nbatch operation asynchronously.\n\nThis flag is only effective for process resources. For other resource types\n(decisions, forms, generic resources), this flag is ignored and no history\nwill be deleted. In those cases, the `batchOperation` field in the response\nwill not be populated.\n"
3185
+ description: "Indicates if the historic data associated with the resource should also be deleted\nasynchronously.\n\nThis flag is effective for process definitions and decision requirements definitions.\nFor other resource types (forms, generic resources) it is ignored and no history is\ndeleted. For a decision requirements definition the `batchOperation` field in the\nresponse carries the created batch operation. For a process definition the history is\ndeleted as part of the definition's draining/deletion lifecycle and no batch operation is\nreturned.\n"
3186
3186
  })).default(false)
3187
3187
  }),
3188
3188
  import_zod4.z.null()
@@ -3751,9 +3751,10 @@ var init_zod_gen = __esm({
3751
3751
  })),
3752
3752
  state: import_zod4.z.optional(import_zod4.z.enum([
3753
3753
  "ACTIVE",
3754
+ "DRAINING",
3754
3755
  "DELETED"
3755
3756
  ]).register(import_zod4.z.globalRegistry, {
3756
- description: "Filter by the process definition's state.\nWhen not set, process definitions in any state are returned.\nSet to `ACTIVE` to exclude deleted definitions (recommended for most use cases).\nSet to `DELETED` to return only definitions that have been deleted but are still\nretained in secondary storage.\n"
3757
+ description: "Filter by the process definition's state.\nWhen not set, process definitions in any state are returned.\nSet to `ACTIVE` to exclude draining and deleted definitions (recommended for most use cases).\nSet to `DRAINING` to return only definitions that are being deleted but still have\nactive process instances draining.\nSet to `DELETED` to return only definitions that have been deleted but are still\nretained in secondary storage.\n"
3757
3758
  }))
3758
3759
  }).register(import_zod4.z.globalRegistry, {
3759
3760
  description: "Process definition search filter."
@@ -3781,9 +3782,10 @@ var init_zod_gen = __esm({
3781
3782
  }),
3782
3783
  state: import_zod4.z.enum([
3783
3784
  "ACTIVE",
3785
+ "DRAINING",
3784
3786
  "DELETED"
3785
3787
  ]).register(import_zod4.z.globalRegistry, {
3786
- description: "The state of this process definition."
3788
+ description: "The state of this process definition.\n`DRAINING` indicates the definition is being deleted but still has active process\ninstances draining before it is removed.\n"
3787
3789
  })
3788
3790
  });
3789
3791
  zProcessElementStatisticsResult = import_zod4.z.object({
@@ -3883,7 +3885,7 @@ var init_zod_gen = __esm({
3883
3885
  zProcessInstanceCreationInstructionById = import_zod4.z.object({
3884
3886
  processDefinitionId: zProcessDefinitionId,
3885
3887
  processDefinitionVersion: import_zod4.z.optional(import_zod4.z.int().register(import_zod4.z.globalRegistry, {
3886
- description: "The version of the process. By default, the latest version of the process is used.\n"
3888
+ description: "The version of the process. If omitted, the latest active version is used.\n"
3887
3889
  })).default(-1),
3888
3890
  variables: import_zod4.z.optional(import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).register(import_zod4.z.globalRegistry, {
3889
3891
  description: "JSON object that will instantiate the variables for the root variable scope\nof the process instance.\n"
@@ -12581,7 +12583,7 @@ function createLogger(opts = {}) {
12581
12583
  }
12582
12584
 
12583
12585
  // src/runtime/version.ts
12584
- var packageVersion = "9.1.4";
12586
+ var packageVersion = "9.1.5";
12585
12587
 
12586
12588
  // src/runtime/supportLogger.ts
12587
12589
  var NoopSupportLogger = class {
@@ -13612,6 +13614,33 @@ var BackpressureManager = class {
13612
13614
  }
13613
13615
  };
13614
13616
 
13617
+ // src/runtime/pollBackoff.ts
13618
+ var DEFAULT_POLL_BACKOFF_MIN_MS = 1e3;
13619
+ var DEFAULT_POLL_BACKOFF_MAX_MS = 3e4;
13620
+ var MAX_SAFE_TIMEOUT_MS = 2147483647;
13621
+ function computePollBackoffMs(attempt, opts) {
13622
+ const rng = opts.rng ?? Math.random;
13623
+ const min = Number.isFinite(opts.minMs) ? Math.min(MAX_SAFE_TIMEOUT_MS, Math.max(0, Math.floor(opts.minMs))) : 0;
13624
+ const max = Number.isFinite(opts.maxMs) ? Math.min(MAX_SAFE_TIMEOUT_MS, Math.max(min, Math.floor(opts.maxMs))) : min;
13625
+ const safeAttempt = Number.isFinite(attempt) ? Math.max(1, Math.floor(attempt)) : 1;
13626
+ const exponent = Math.min(safeAttempt - 1, 53);
13627
+ const cap = Math.min(max, min * 2 ** exponent);
13628
+ const half = cap / 2;
13629
+ const r = rng();
13630
+ const jitter = Number.isFinite(r) ? Math.min(1, Math.max(0, r)) : 0;
13631
+ return Math.round(half + jitter * half);
13632
+ }
13633
+ function nextActivationRetryDelayMs(attempt, cfg, rng) {
13634
+ if (cfg.pollBackoffMinMs > 0) {
13635
+ return computePollBackoffMs(attempt, {
13636
+ minMs: cfg.pollBackoffMinMs,
13637
+ maxMs: cfg.pollBackoffMaxMs,
13638
+ rng
13639
+ });
13640
+ }
13641
+ return Number.isFinite(cfg.pollIntervalMs) ? Math.max(0, Math.round(cfg.pollIntervalMs)) : 0;
13642
+ }
13643
+
13615
13644
  // src/runtime/jobWorker.ts
13616
13645
  var JobActionReceipt = "JOB_ACTION_RECEIPT";
13617
13646
  var _workerCounter = 0;
@@ -13627,11 +13656,15 @@ var JobWorker = class {
13627
13656
  _pollTimer = null;
13628
13657
  _inFlightActivation = null;
13629
13658
  // CancelablePromise-like
13659
+ /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
13660
+ _consecutiveActivationErrors = 0;
13630
13661
  _log;
13631
13662
  constructor(client2, cfg) {
13632
13663
  this._client = client2;
13633
13664
  this._cfg = {
13634
13665
  pollIntervalMs: 1,
13666
+ pollBackoffMinMs: DEFAULT_POLL_BACKOFF_MIN_MS,
13667
+ pollBackoffMaxMs: DEFAULT_POLL_BACKOFF_MAX_MS,
13635
13668
  autoStart: true,
13636
13669
  validateSchemas: false,
13637
13670
  maxParallelJobs: 10,
@@ -13758,6 +13791,7 @@ var JobWorker = class {
13758
13791
  this._inFlightActivation = this._client.activateJobs(body);
13759
13792
  const activation = await this._inFlightActivation;
13760
13793
  this._inFlightActivation = null;
13794
+ this._consecutiveActivationErrors = 0;
13761
13795
  result = activation?.jobs || [];
13762
13796
  this._log.debug(() => ["activation.response", { jobs: result.length }]);
13763
13797
  } catch (e) {
@@ -13765,10 +13799,21 @@ var JobWorker = class {
13765
13799
  if (this._stopped) return;
13766
13800
  if (e?.name === "CancelSdkError") {
13767
13801
  this._log.debug("activation.cancelled");
13768
- } else {
13769
- this._log.error("activation.error", e);
13802
+ this._scheduleNext(this._cfg.pollIntervalMs);
13803
+ return;
13770
13804
  }
13771
- this._scheduleNext(this._cfg.pollIntervalMs);
13805
+ this._consecutiveActivationErrors += 1;
13806
+ const delayMs = nextActivationRetryDelayMs(this._consecutiveActivationErrors, {
13807
+ pollIntervalMs: this._cfg.pollIntervalMs,
13808
+ pollBackoffMinMs: this._cfg.pollBackoffMinMs,
13809
+ pollBackoffMaxMs: this._cfg.pollBackoffMaxMs
13810
+ });
13811
+ this._log.error("activation.error", e);
13812
+ this._log.debug(() => [
13813
+ "activation.retry",
13814
+ { attempt: this._consecutiveActivationErrors, retryInMs: delayMs }
13815
+ ]);
13816
+ this._scheduleNext(delayMs);
13772
13817
  return;
13773
13818
  }
13774
13819
  if (!result || result.length === 0) {
@@ -13919,6 +13964,8 @@ var ThreadedJobWorker = class {
13919
13964
  _stopped = false;
13920
13965
  _pollTimer = null;
13921
13966
  _inFlightActivation = null;
13967
+ /** Consecutive failed activation requests; drives the retry backoff, reset on success. */
13968
+ _consecutiveActivationErrors = 0;
13922
13969
  _log;
13923
13970
  _jobQueue = [];
13924
13971
  constructor(client2, pool, cfg) {
@@ -13926,6 +13973,8 @@ var ThreadedJobWorker = class {
13926
13973
  this._pool = pool;
13927
13974
  this._cfg = {
13928
13975
  pollIntervalMs: 1,
13976
+ pollBackoffMinMs: DEFAULT_POLL_BACKOFF_MIN_MS,
13977
+ pollBackoffMaxMs: DEFAULT_POLL_BACKOFF_MAX_MS,
13929
13978
  autoStart: true,
13930
13979
  validateSchemas: false,
13931
13980
  maxParallelJobs: 10,
@@ -14139,6 +14188,7 @@ var ThreadedJobWorker = class {
14139
14188
  this._inFlightActivation = this._client.activateJobs(body);
14140
14189
  const activation = await this._inFlightActivation;
14141
14190
  this._inFlightActivation = null;
14191
+ this._consecutiveActivationErrors = 0;
14142
14192
  result = activation?.jobs || [];
14143
14193
  this._log.debug(() => ["activation.response", { jobs: result.length }]);
14144
14194
  } catch (e) {
@@ -14146,10 +14196,21 @@ var ThreadedJobWorker = class {
14146
14196
  if (this._stopped) return;
14147
14197
  if (e?.name === "CancelSdkError") {
14148
14198
  this._log.debug("activation.cancelled");
14149
- } else {
14150
- this._log.error("activation.error", e);
14199
+ this._scheduleNext(this._cfg.pollIntervalMs);
14200
+ return;
14151
14201
  }
14152
- this._scheduleNext(this._cfg.pollIntervalMs);
14202
+ this._consecutiveActivationErrors += 1;
14203
+ const delayMs = nextActivationRetryDelayMs(this._consecutiveActivationErrors, {
14204
+ pollIntervalMs: this._cfg.pollIntervalMs,
14205
+ pollBackoffMinMs: this._cfg.pollBackoffMinMs,
14206
+ pollBackoffMaxMs: this._cfg.pollBackoffMaxMs
14207
+ });
14208
+ this._log.error("activation.error", e);
14209
+ this._log.debug(() => [
14210
+ "activation.retry",
14211
+ { attempt: this._consecutiveActivationErrors, retryInMs: delayMs }
14212
+ ]);
14213
+ this._scheduleNext(delayMs);
14153
14214
  return;
14154
14215
  }
14155
14216
  if (!result || result.length === 0) {