CircuitBreakerConfig
Defined in: src/core/types.ts:156
Properties
Section titled “Properties”enabled?
Section titled “enabled?”
optionalenabled?:boolean
Defined in: src/core/types.ts:163
Turns the breaker on. In 1.x a circuitBreaker without
enabled: true is inert; in 2.0, setting circuitBreaker turns it on,
as with retryBudget and rateLimit, and only enabled: false turns
it off. Pass enabled explicitly, or remove a config you don’t use,
so 2.0 doesn’t change your behavior.
Default
Section titled “Default”falsefailureThreshold?
Section titled “failureThreshold?”
optionalfailureThreshold?:number
Defined in: src/core/types.ts:166
Consecutive-failure trip mode (default strategy).
Default
Section titled “Default”window?
Section titled “window?”
optionalwindow?:object
Defined in: src/core/types.ts:168
Rolling-window trip mode. If set, used INSTEAD of failureThreshold.
sizeMs
Section titled “sizeMs”sizeMs:
number
failureRatePercent
Section titled “failureRatePercent”failureRatePercent:
number
minimumRequests
Section titled “minimumRequests”minimumRequests:
number
resetTimeoutMs?
Section titled “resetTimeoutMs?”
optionalresetTimeoutMs?:number
Defined in: src/core/types.ts:175
ms to stay open before allowing a half-open trial.
Default
Section titled “Default”halfOpenMaxAttempts?
Section titled “halfOpenMaxAttempts?”
optionalhalfOpenMaxAttempts?:number
Defined in: src/core/types.ts:178
concurrent trial requests allowed while half-open.
Default
Section titled “Default”DEFAULT_HALF_OPEN_MAX_ATTEMPTS
isFailure?
Section titled “isFailure?”
optionalisFailure?: (error) =>boolean
Defined in: src/core/types.ts:183
Override default failure classification (network/timeout/retryable_status). Not consulted for an error that shows the attempt never reached the host (e.g. a body factory that threw before the request was dispatched) — those are always ignored, since there is no host-health signal to classify.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
