@camunda8/orchestration-cluster-api 8.9.0-alpha.12 → 8.9.0-alpha.13

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.
@@ -1,3 +1,3 @@
1
- export { h as CamundaFpClient, A3 as DomainError, A4 as DomainErrorTag, E as Either, A2 as FnKeys, A1 as Fpify, A5 as HttpError, A6 as Left, A7 as Right, Ad as TaskEither, Ac as classifyDomainError, g as createCamundaFpClient, Aa as eventuallyTE, Ab as foldDomainError, i as isLeft, j as isRight, A8 as retryTE, A9 as withTimeoutTE } from '../index-BtaIAxYd.cjs';
1
+ export { h as CamundaFpClient, A3 as DomainError, A4 as DomainErrorTag, E as Either, A2 as FnKeys, A1 as Fpify, A5 as HttpError, A6 as Left, A7 as Right, Ad as TaskEither, Ac as classifyDomainError, g as createCamundaFpClient, Aa as eventuallyTE, Ab as foldDomainError, i as isLeft, j as isRight, A8 as retryTE, A9 as withTimeoutTE } from '../index-Cwx7jNBm.cjs';
2
2
  import 'zod';
3
3
  import '../logger-D-p21VHo.cjs';
@@ -1,3 +1,3 @@
1
- export { h as CamundaFpClient, A3 as DomainError, A4 as DomainErrorTag, E as Either, A2 as FnKeys, A1 as Fpify, A5 as HttpError, A6 as Left, A7 as Right, Ad as TaskEither, Ac as classifyDomainError, g as createCamundaFpClient, Aa as eventuallyTE, Ab as foldDomainError, i as isLeft, j as isRight, A8 as retryTE, A9 as withTimeoutTE } from '../index-CCQ7L-Rm.js';
1
+ export { h as CamundaFpClient, A3 as DomainError, A4 as DomainErrorTag, E as Either, A2 as FnKeys, A1 as Fpify, A5 as HttpError, A6 as Left, A7 as Right, Ad as TaskEither, Ac as classifyDomainError, g as createCamundaFpClient, Aa as eventuallyTE, Ab as foldDomainError, i as isLeft, j as isRight, A8 as retryTE, A9 as withTimeoutTE } from '../index-Bps8dBEQ.js';
2
2
  import 'zod';
3
3
  import '../logger-D-p21VHo.js';
package/dist/fp/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  isRight,
8
8
  retryTE,
9
9
  withTimeoutTE
10
- } from "../chunk-4LIDRKND.js";
10
+ } from "../chunk-ULXL7H75.js";
11
11
  import "../chunk-W6JB7JZH.js";
12
12
  export {
13
13
  classifyDomainError,
@@ -19484,6 +19484,7 @@ declare class CamundaClient {
19484
19484
  permitsMax: number | null;
19485
19485
  permitsCurrent: number;
19486
19486
  waiters: number;
19487
+ backoffMs: number;
19487
19488
  } | {
19488
19489
  severity: string;
19489
19490
  permitsMax: null;
@@ -19484,6 +19484,7 @@ declare class CamundaClient {
19484
19484
  permitsMax: number | null;
19485
19485
  permitsCurrent: number;
19486
19486
  waiters: number;
19487
+ backoffMs: number;
19487
19488
  } | {
19488
19489
  severity: string;
19489
19490
  permitsMax: null;
package/dist/index.cjs CHANGED
@@ -12353,7 +12353,7 @@ function createLogger(opts = {}) {
12353
12353
  }
12354
12354
 
12355
12355
  // src/runtime/version.ts
12356
- var packageVersion = "8.9.0-alpha.12";
12356
+ var packageVersion = "8.9.0-alpha.13";
12357
12357
 
12358
12358
  // src/runtime/supportLogger.ts
12359
12359
  var NoopSupportLogger = class {
@@ -13153,6 +13153,7 @@ async function executeWithHttpRetry(fn, policy, logger, classify = defaultHttpCl
13153
13153
  var BackpressureManager = class {
13154
13154
  logger;
13155
13155
  now;
13156
+ sleep;
13156
13157
  cfg;
13157
13158
  severity = "healthy";
13158
13159
  consecutive = 0;
@@ -13165,9 +13166,12 @@ var BackpressureManager = class {
13165
13166
  observeOnly = false;
13166
13167
  healthySince = 0;
13167
13168
  // timestamp when severity last became healthy
13169
+ backoffMs = 0;
13170
+ // current backoff delay in ms (0 = no backoff)
13168
13171
  constructor(opts = {}) {
13169
13172
  this.logger = opts.logger;
13170
13173
  this.now = opts.now || (() => Date.now());
13174
+ this.sleep = opts.sleep || ((ms) => new Promise((r) => setTimeout(r, ms)));
13171
13175
  this.cfg = {
13172
13176
  enabled: true,
13173
13177
  initialMaxConcurrency: null,
@@ -13181,6 +13185,9 @@ var BackpressureManager = class {
13181
13185
  maxWaiters: 1e3,
13182
13186
  healthyRecoveryMultiplier: 1.5,
13183
13187
  unlimitedAfterHealthyMs: 3e4,
13188
+ backoffInitialMs: 25,
13189
+ backoffMaxMs: 2e3,
13190
+ backoffEscalate: 2,
13184
13191
  ...opts.config
13185
13192
  };
13186
13193
  this.observeOnly = !!this.cfg.observeOnly;
@@ -13196,7 +13203,8 @@ var BackpressureManager = class {
13196
13203
  // When disabled, report unlimited semantics explicitly
13197
13204
  permitsMax: this.cfg.enabled === false ? null : this.permitsMax,
13198
13205
  permitsCurrent: this.cfg.enabled === false ? 0 : this.permitsCurrent,
13199
- waiters: this.waiters.length
13206
+ waiters: this.waiters.length,
13207
+ backoffMs: this.backoffMs
13200
13208
  };
13201
13209
  }
13202
13210
  log(evt, data, prevSeverity) {
@@ -13218,6 +13226,10 @@ var BackpressureManager = class {
13218
13226
  if (this.observeOnly) return;
13219
13227
  if (!this.isEnabled()) return;
13220
13228
  if (this.permitsMax === null) return;
13229
+ if (this.backoffMs > 0) {
13230
+ await this.sleep(this.backoffMs);
13231
+ if (this.permitsMax === null) return;
13232
+ }
13221
13233
  if (this.permitsCurrent < (this.permitsMax || 0)) {
13222
13234
  this.permitsCurrent++;
13223
13235
  return;
@@ -13281,11 +13293,23 @@ var BackpressureManager = class {
13281
13293
  } else if (this.severity === "soft") {
13282
13294
  if (!this.observeOnly) this.scalePermits(this.cfg.reduceFactor);
13283
13295
  }
13296
+ if (!this.observeOnly && this.permitsMax !== null && this.permitsMax <= this.cfg.floorConcurrency && this.severity === "severe") {
13297
+ if (this.backoffMs === 0) {
13298
+ this.backoffMs = this.cfg.backoffInitialMs;
13299
+ } else {
13300
+ this.backoffMs = Math.min(this.cfg.backoffMaxMs, this.backoffMs * this.cfg.backoffEscalate);
13301
+ }
13302
+ this.log("backoff.escalate", { delayMs: this.backoffMs });
13303
+ }
13284
13304
  if (this.severity !== prevSeverity)
13285
13305
  this.log("severity", { severity: this.severity }, prevSeverity);
13286
13306
  }
13287
13307
  recordHealthyHint() {
13288
13308
  if (!this.cfg.enabled && !this.observeOnly) return;
13309
+ if (this.backoffMs > 0) {
13310
+ this.backoffMs = 0;
13311
+ this.log("backoff.clear", { reason: "healthy-hint" });
13312
+ }
13289
13313
  const now2 = this.now();
13290
13314
  this.maybeRecover(now2);
13291
13315
  }
@@ -13309,13 +13333,23 @@ var BackpressureManager = class {
13309
13333
  this.healthySince = now2;
13310
13334
  }
13311
13335
  if (this.severity === "healthy") this.consecutive = 0;
13312
- if (prev !== this.severity) this.log("severity", { severity: this.severity }, prev);
13336
+ if (prev !== this.severity) {
13337
+ if (this.backoffMs > 0) {
13338
+ this.backoffMs = 0;
13339
+ this.log("backoff.clear", { reason: "severity-decay" });
13340
+ }
13341
+ this.log("severity", { severity: this.severity }, prev);
13342
+ }
13313
13343
  }
13314
13344
  if (this.permitsMax !== null) {
13315
13345
  const bootstrapCap = this.cfg.initialMaxConcurrency ?? 16;
13316
13346
  if (this.severity !== "healthy") {
13317
13347
  if (this.permitsMax < bootstrapCap) {
13318
13348
  this.permitsMax = Math.min(bootstrapCap, this.permitsMax + this.cfg.recoveryStep);
13349
+ if (this.permitsMax > this.cfg.floorConcurrency && this.backoffMs > 0) {
13350
+ this.backoffMs = 0;
13351
+ this.log("backoff.clear", { reason: "left-floor" });
13352
+ }
13319
13353
  this.log("permits.recover", { max: this.permitsMax, phase: "additive" }, this.severity);
13320
13354
  this.release();
13321
13355
  }
@@ -13323,6 +13357,7 @@ var BackpressureManager = class {
13323
13357
  if (this.healthySince > 0 && now2 - this.healthySince >= this.cfg.unlimitedAfterHealthyMs) {
13324
13358
  this.permitsMax = null;
13325
13359
  this.permitsCurrent = 0;
13360
+ this.backoffMs = 0;
13326
13361
  while (this.waiters.length) {
13327
13362
  const w = this.waiters.shift();
13328
13363
  try {