Zum Inhalt springen
Deutsch

CircuitBreakerOptionsBuilder

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Defined in: src/pattern/CircuitBreakerOptions.ts:158

Fluent builder for CircuitBreakerOptionsType:

new CircuitBreaker(CircuitBreakerOptions.create()
.withMaxFailures(5)
.withResetTimeoutMs(10_000));

new CircuitBreakerOptionsBuilder(): CircuitBreakerOptionsBuilder

CircuitBreakerOptionsBuilder

OptionsBuilder.constructor

build(): Partial<T>

Defined in: src/util/OptionsBuilder.ts:51

Snapshot the set fields as an independent Partial<T> (own props only).

Partial<T>

OptionsBuilder.build


withBackoffFactor(backoffFactor): this

Defined in: src/pattern/CircuitBreakerOptions.ts:190

Multiplier applied to the reopen window per consecutive open (>= 1).

number

this


withCallTimeoutMs(callTimeoutMs): this

Defined in: src/pattern/CircuitBreakerOptions.ts:175

Per-call timeout; exceeding it counts as a failure.

number

this


withIgnoredErrorNames(ignoredErrorNames): this

Defined in: src/pattern/CircuitBreakerOptions.ts:200

Error.name values that never count as a failure.

readonly string[]

this


withIsFailure(isFailure): this

Defined in: src/pattern/CircuitBreakerOptions.ts:180

Classify errors as non-failures to bypass breaker counting.

(err) => boolean

this


withMaxFailures(maxFailures): this

Defined in: src/pattern/CircuitBreakerOptions.ts:165

Consecutive failures before the breaker opens. Must be >= 1.

number

this


withMaxResetTimeoutMs(maxResetTimeoutMs): this

Defined in: src/pattern/CircuitBreakerOptions.ts:185

Ceiling the reopen window may grow to under withBackoffFactor (ms).

number

this


withRandom(random): this

Defined in: src/pattern/CircuitBreakerOptions.ts:210

() => number

this


withRandomFactor(randomFactor): this

Defined in: src/pattern/CircuitBreakerOptions.ts:195

Jitter fraction in [0, 1] spread over the reopen window.

number

this


withResetTimeoutMs(resetTimeoutMs): this

Defined in: src/pattern/CircuitBreakerOptions.ts:170

How long the breaker stays open before letting a probe through (ms).

number

this


withScheduler(scheduler): this

Defined in: src/pattern/CircuitBreakerOptions.ts:206

Where the breaker reads the time and arms its call timeout.

Scheduler

this


static create(): CircuitBreakerOptionsBuilder

Defined in: src/pattern/CircuitBreakerOptions.ts:160

Start a fresh builder.

CircuitBreakerOptionsBuilder