@rotorsoft/act 1.32.28 → 1.32.29
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/README.md +10 -8
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/internal/circuit-breaker.d.ts +6 -5
- package/dist/@types/internal/circuit-breaker.d.ts.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts +2 -2
- package/dist/index.cjs +7 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -28,9 +28,9 @@ export type CircuitBreakerHooks = {
|
|
|
28
28
|
/** Invoked on every {@link CircuitBreaker.failed} with the error and state. */
|
|
29
29
|
readonly on_error?: (error: unknown, circuit: CircuitState) => void;
|
|
30
30
|
/**
|
|
31
|
-
* Invoked once, `cooldownMs` after the
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* Invoked once, `cooldownMs` after the latest failure, open or not. The
|
|
32
|
+
* orchestrator wires it to a settle, so recovery is automatic even on the
|
|
33
|
+
* default lane, which has no periodic poller.
|
|
34
34
|
*/
|
|
35
35
|
readonly on_retry?: () => void;
|
|
36
36
|
};
|
|
@@ -61,8 +61,9 @@ export declare class CircuitBreaker {
|
|
|
61
61
|
* if a half-open trial just failed. Returns the resulting state.
|
|
62
62
|
*
|
|
63
63
|
* Callers gate on the state directly — `state(now) === "open"` means skip.
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* Every failure (re)schedules the `on_retry` wake, so one failed pass on
|
|
65
|
+
* an idle app retries without waiting for the breaker to open; always
|
|
66
|
+
* surfaces the failure via `on_error`.
|
|
66
67
|
*/
|
|
67
68
|
failed(now: number, error?: unknown): CircuitState;
|
|
68
69
|
/** Cancel the pending retry timer. Idempotent; call on shutdown. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../../../src/internal/circuit-brea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AAC;AAM3D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC,CAAC;AAEF,qBAAa,cAAc;IACzB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,KAAK,CAA4C;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAE7C,YAAY,MAAM,EAAE,oBAAoB,EAAE,KAAK,GAAE,mBAAwB,EAIxE;IAED;;;;;OAKG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,uEAAuE;IACvE,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,gDAAgD;IAChD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAG/B;IAED,wEAAwE;IACxE,MAAM,IAAI,IAAI,CAIb;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,YAAY,CAKjD;IAED,oEAAoE;IACpE,IAAI,IAAI,IAAI,CAEX;IAED;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,WAAW;IAOnB,6DAA6D;IAC7D,OAAO,CAAC,QAAQ;CAcjB"}
|
|
@@ -64,8 +64,8 @@ export declare class DrainController<TEvents extends Schemas, TActions extends S
|
|
|
64
64
|
* Local wake at the earliest parked (backoff or defer) visit, or at the
|
|
65
65
|
* lease expiry after a failed pass (the {@link RETRY} key); the schedule
|
|
66
66
|
* itself is persisted. On an idle app nothing else would drain it. It
|
|
67
|
-
* drains until a pass leases nothing, and an entry
|
|
68
|
-
* until a later pass claims nothing.
|
|
67
|
+
* drains until a pass leases nothing or the controller stops, and an entry
|
|
68
|
+
* stays until handled or until a later pass claims nothing.
|
|
69
69
|
*/
|
|
70
70
|
private readonly _defer;
|
|
71
71
|
private _worker;
|
package/dist/index.cjs
CHANGED
|
@@ -2478,12 +2478,13 @@ var CircuitBreaker = class {
|
|
|
2478
2478
|
* if a half-open trial just failed. Returns the resulting state.
|
|
2479
2479
|
*
|
|
2480
2480
|
* Callers gate on the state directly — `state(now) === "open"` means skip.
|
|
2481
|
-
*
|
|
2482
|
-
*
|
|
2481
|
+
* Every failure (re)schedules the `on_retry` wake, so one failed pass on
|
|
2482
|
+
* an idle app retries without waiting for the breaker to open; always
|
|
2483
|
+
* surfaces the failure via `on_error`.
|
|
2483
2484
|
*/
|
|
2484
2485
|
failed(now, error) {
|
|
2485
2486
|
const circuit = this._advance(now);
|
|
2486
|
-
|
|
2487
|
+
this._schedule_wake();
|
|
2487
2488
|
this._hooks.on_error?.(error, circuit);
|
|
2488
2489
|
return circuit;
|
|
2489
2490
|
}
|
|
@@ -4170,13 +4171,13 @@ var DrainController = class {
|
|
|
4170
4171
|
* Local wake at the earliest parked (backoff or defer) visit, or at the
|
|
4171
4172
|
* lease expiry after a failed pass (the {@link RETRY} key); the schedule
|
|
4172
4173
|
* itself is persisted. On an idle app nothing else would drain it. It
|
|
4173
|
-
* drains until a pass leases nothing, and an entry
|
|
4174
|
-
* until a later pass claims nothing.
|
|
4174
|
+
* drains until a pass leases nothing or the controller stops, and an entry
|
|
4175
|
+
* stays until handled or until a later pass claims nothing.
|
|
4175
4176
|
*/
|
|
4176
4177
|
_defer = new DeferTimer(() => {
|
|
4177
4178
|
this._armed = true;
|
|
4178
4179
|
void this._deps.run_scoped(async () => {
|
|
4179
|
-
while ((await this.drain()).leased.length > 0) ;
|
|
4180
|
+
while (!this._stopped && (await this.drain()).leased.length > 0) ;
|
|
4180
4181
|
});
|
|
4181
4182
|
});
|
|
4182
4183
|
_worker;
|