@camunda8/orchestration-cluster-api 10.0.0-alpha.38 → 10.0.0-alpha.39
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 +7 -0
- package/README.md +125 -5
- package/dist/{CamundaClient-BMOpGKIo.d.ts → CamundaClient-Crt5W0EI.d.ts} +8 -9
- package/dist/{CamundaClient-CvdIL8uM.d.cts → CamundaClient-VlYVveFG.d.cts} +8 -9
- package/dist/{chunk-LPNUMNEM.js → chunk-LNMC2FKC.js} +73 -74
- package/dist/chunk-LNMC2FKC.js.map +1 -0
- package/dist/effect/index.cjs +109 -74
- package/dist/effect/index.cjs.map +1 -1
- package/dist/effect/index.d.cts +48 -4
- package/dist/effect/index.d.ts +48 -4
- package/dist/effect/index.js +45 -8
- package/dist/effect/index.js.map +1 -1
- package/dist/index.cjs +72 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-LPNUMNEM.js.map +0 -1
|
@@ -404,6 +404,51 @@ function nextActivationRetryDelayMs(attempt, cfg, rng) {
|
|
|
404
404
|
return Number.isFinite(cfg.pollIntervalMs) ? Math.max(0, Math.round(cfg.pollIntervalMs)) : 0;
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
+
// src/runtime/workerGracefulStop.ts
|
|
408
|
+
async function stopWorkerGracefully(deps, opts) {
|
|
409
|
+
const waitUpToMs = opts?.waitUpToMs ?? 5e3;
|
|
410
|
+
const checkIntervalMs = opts?.checkIntervalMs ?? 10;
|
|
411
|
+
deps.haltPolling();
|
|
412
|
+
const start = liveClock.now();
|
|
413
|
+
const inFlight = deps.inFlightActivation();
|
|
414
|
+
if (inFlight) {
|
|
415
|
+
const budget = liveClock.deadline(waitUpToMs);
|
|
416
|
+
try {
|
|
417
|
+
await Promise.race([
|
|
418
|
+
inFlight,
|
|
419
|
+
new Promise((_, rej) => {
|
|
420
|
+
const reject = () => rej(new Error("activation.wait.timeout"));
|
|
421
|
+
if (budget.signal.aborted) reject();
|
|
422
|
+
else budget.signal.addEventListener("abort", reject, { once: true });
|
|
423
|
+
})
|
|
424
|
+
]);
|
|
425
|
+
} catch (e) {
|
|
426
|
+
if (e && e.message === "activation.wait.timeout") {
|
|
427
|
+
deps.log.debug("worker.gracefulStop.activationTimeout");
|
|
428
|
+
}
|
|
429
|
+
} finally {
|
|
430
|
+
budget.dispose();
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
while (deps.activeJobs() > 0 && liveClock.now() - start < waitUpToMs) {
|
|
434
|
+
await liveClock.sleep(checkIntervalMs);
|
|
435
|
+
}
|
|
436
|
+
const timedOut = deps.activeJobs() > 0;
|
|
437
|
+
if (timedOut) {
|
|
438
|
+
const pending = deps.inFlightActivation();
|
|
439
|
+
if (pending?.cancel) {
|
|
440
|
+
try {
|
|
441
|
+
pending.cancel();
|
|
442
|
+
} catch {
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
deps.log.debug("worker.gracefulStop.timeout", { remaining: deps.activeJobs() });
|
|
446
|
+
} else {
|
|
447
|
+
deps.log.debug("worker.gracefulStop.done");
|
|
448
|
+
}
|
|
449
|
+
return { remainingJobs: deps.activeJobs(), timedOut };
|
|
450
|
+
}
|
|
451
|
+
|
|
407
452
|
// src/runtime/workerStartGate.ts
|
|
408
453
|
var WorkerStartGate = class {
|
|
409
454
|
/**
|
|
@@ -550,42 +595,19 @@ var JobWorker = class {
|
|
|
550
595
|
* If timeout is reached, falls back to hard stop logic (cancels activation if still pending).
|
|
551
596
|
*/
|
|
552
597
|
async stopGracefully(opts) {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
]);
|
|
567
|
-
} catch (e) {
|
|
568
|
-
if (e && e.message === "activation.wait.timeout") {
|
|
569
|
-
this._log.debug("worker.gracefulStop.activationTimeout");
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
while (this._activeJobs > 0 && Date.now() - start < waitUpToMs) {
|
|
574
|
-
await new Promise((r) => setTimeout(r, checkIntervalMs));
|
|
575
|
-
}
|
|
576
|
-
const timedOut = this._activeJobs > 0;
|
|
577
|
-
if (timedOut) {
|
|
578
|
-
if (this._inFlightActivation?.cancel) {
|
|
579
|
-
try {
|
|
580
|
-
this._inFlightActivation.cancel();
|
|
581
|
-
} catch {
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
this._log.debug("worker.gracefulStop.timeout", { remaining: this._activeJobs });
|
|
585
|
-
} else {
|
|
586
|
-
this._log.debug("worker.gracefulStop.done");
|
|
587
|
-
}
|
|
588
|
-
return { remainingJobs: this._activeJobs, timedOut };
|
|
598
|
+
return stopWorkerGracefully(
|
|
599
|
+
{
|
|
600
|
+
haltPolling: () => {
|
|
601
|
+
this._stopped = true;
|
|
602
|
+
if (this._pollTimer) clearTimeout(this._pollTimer);
|
|
603
|
+
this._pollTimer = null;
|
|
604
|
+
},
|
|
605
|
+
activeJobs: () => this._activeJobs,
|
|
606
|
+
inFlightActivation: () => this._inFlightActivation,
|
|
607
|
+
log: this._log
|
|
608
|
+
},
|
|
609
|
+
opts
|
|
610
|
+
);
|
|
589
611
|
}
|
|
590
612
|
_scheduleNext(delayMs) {
|
|
591
613
|
if (this._stopped) return;
|
|
@@ -5233,7 +5255,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
|
|
|
5233
5255
|
}
|
|
5234
5256
|
|
|
5235
5257
|
// src/runtime/version.ts
|
|
5236
|
-
var packageVersion = "10.0.0-alpha.
|
|
5258
|
+
var packageVersion = "10.0.0-alpha.39";
|
|
5237
5259
|
|
|
5238
5260
|
// src/runtime/supportLogger.ts
|
|
5239
5261
|
var NoopSupportLogger = class {
|
|
@@ -6429,42 +6451,19 @@ var ThreadedJobWorker = class {
|
|
|
6429
6451
|
this._log.info("worker.stop");
|
|
6430
6452
|
}
|
|
6431
6453
|
async stopGracefully(opts) {
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
]);
|
|
6446
|
-
} catch (e) {
|
|
6447
|
-
if (e && e.message === "activation.wait.timeout") {
|
|
6448
|
-
this._log.debug("worker.gracefulStop.activationTimeout");
|
|
6449
|
-
}
|
|
6450
|
-
}
|
|
6451
|
-
}
|
|
6452
|
-
while (this._activeJobs > 0 && Date.now() - start < waitUpToMs) {
|
|
6453
|
-
await new Promise((r) => setTimeout(r, checkIntervalMs));
|
|
6454
|
-
}
|
|
6455
|
-
const timedOut = this._activeJobs > 0;
|
|
6456
|
-
if (timedOut) {
|
|
6457
|
-
if (this._inFlightActivation?.cancel) {
|
|
6458
|
-
try {
|
|
6459
|
-
this._inFlightActivation.cancel();
|
|
6460
|
-
} catch {
|
|
6461
|
-
}
|
|
6462
|
-
}
|
|
6463
|
-
this._log.debug("worker.gracefulStop.timeout", { remaining: this._activeJobs });
|
|
6464
|
-
} else {
|
|
6465
|
-
this._log.debug("worker.gracefulStop.done");
|
|
6466
|
-
}
|
|
6467
|
-
return { remainingJobs: this._activeJobs, timedOut };
|
|
6454
|
+
return stopWorkerGracefully(
|
|
6455
|
+
{
|
|
6456
|
+
haltPolling: () => {
|
|
6457
|
+
this._stopped = true;
|
|
6458
|
+
if (this._pollTimer) clearTimeout(this._pollTimer);
|
|
6459
|
+
this._pollTimer = null;
|
|
6460
|
+
},
|
|
6461
|
+
activeJobs: () => this._activeJobs,
|
|
6462
|
+
inFlightActivation: () => this._inFlightActivation,
|
|
6463
|
+
log: this._log
|
|
6464
|
+
},
|
|
6465
|
+
opts
|
|
6466
|
+
);
|
|
6468
6467
|
}
|
|
6469
6468
|
// ─── Job dispatch ───
|
|
6470
6469
|
_drainQueue() {
|
|
@@ -21445,4 +21444,4 @@ export {
|
|
|
21445
21444
|
createCamundaClient,
|
|
21446
21445
|
CamundaClient
|
|
21447
21446
|
};
|
|
21448
|
-
//# sourceMappingURL=chunk-
|
|
21447
|
+
//# sourceMappingURL=chunk-LNMC2FKC.js.map
|