Skip to content

CircuitBreakerConfig

Defined in: src/core/types.ts:156

optional enabled?: 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.

false

optional failureThreshold?: number

Defined in: src/core/types.ts:166

Consecutive-failure trip mode (default strategy).

DEFAULT_FAILURE_THRESHOLD


optional window?: object

Defined in: src/core/types.ts:168

Rolling-window trip mode. If set, used INSTEAD of failureThreshold.

sizeMs: number

failureRatePercent: number

minimumRequests: number


optional resetTimeoutMs?: number

Defined in: src/core/types.ts:175

ms to stay open before allowing a half-open trial.

DEFAULT_RESET_TIMEOUT_MS


optional halfOpenMaxAttempts?: number

Defined in: src/core/types.ts:178

concurrent trial requests allowed while half-open.

DEFAULT_HALF_OPEN_MAX_ATTEMPTS


optional isFailure?: (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.

AppError

boolean