CircuitBreakerOptionsBuilder
Это содержимое пока не доступно на вашем языке.
Defined in: src/pattern/CircuitBreakerOptions.ts:158
Fluent builder for CircuitBreakerOptionsType:
new CircuitBreaker(CircuitBreakerOptions.create() .withMaxFailures(5) .withResetTimeoutMs(10_000));Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CircuitBreakerOptionsBuilder():
CircuitBreakerOptionsBuilder
Returns
Section titled “Returns”CircuitBreakerOptionsBuilder
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”build()
Section titled “build()”build():
Partial<T>
Defined in: src/util/OptionsBuilder.ts:51
Snapshot the set fields as an independent Partial<T> (own props only).
Returns
Section titled “Returns”Partial<T>
Inherited from
Section titled “Inherited from”withBackoffFactor()
Section titled “withBackoffFactor()”withBackoffFactor(
backoffFactor):this
Defined in: src/pattern/CircuitBreakerOptions.ts:190
Multiplier applied to the reopen window per consecutive open (>= 1).
Parameters
Section titled “Parameters”backoffFactor
Section titled “backoffFactor”number
Returns
Section titled “Returns”this
withCallTimeoutMs()
Section titled “withCallTimeoutMs()”withCallTimeoutMs(
callTimeoutMs):this
Defined in: src/pattern/CircuitBreakerOptions.ts:175
Per-call timeout; exceeding it counts as a failure.
Parameters
Section titled “Parameters”callTimeoutMs
Section titled “callTimeoutMs”number
Returns
Section titled “Returns”this
withIgnoredErrorNames()
Section titled “withIgnoredErrorNames()”withIgnoredErrorNames(
ignoredErrorNames):this
Defined in: src/pattern/CircuitBreakerOptions.ts:200
Error.name values that never count as a failure.
Parameters
Section titled “Parameters”ignoredErrorNames
Section titled “ignoredErrorNames”readonly string[]
Returns
Section titled “Returns”this
withIsFailure()
Section titled “withIsFailure()”withIsFailure(
isFailure):this
Defined in: src/pattern/CircuitBreakerOptions.ts:180
Classify errors as non-failures to bypass breaker counting.
Parameters
Section titled “Parameters”isFailure
Section titled “isFailure”(err) => boolean
Returns
Section titled “Returns”this
withMaxFailures()
Section titled “withMaxFailures()”withMaxFailures(
maxFailures):this
Defined in: src/pattern/CircuitBreakerOptions.ts:165
Consecutive failures before the breaker opens. Must be >= 1.
Parameters
Section titled “Parameters”maxFailures
Section titled “maxFailures”number
Returns
Section titled “Returns”this
withMaxResetTimeoutMs()
Section titled “withMaxResetTimeoutMs()”withMaxResetTimeoutMs(
maxResetTimeoutMs):this
Defined in: src/pattern/CircuitBreakerOptions.ts:185
Ceiling the reopen window may grow to under withBackoffFactor (ms).
Parameters
Section titled “Parameters”maxResetTimeoutMs
Section titled “maxResetTimeoutMs”number
Returns
Section titled “Returns”this
withRandom()
Section titled “withRandom()”withRandom(
random):this
Defined in: src/pattern/CircuitBreakerOptions.ts:210
Parameters
Section titled “Parameters”random
Section titled “random”() => number
Returns
Section titled “Returns”this
withRandomFactor()
Section titled “withRandomFactor()”withRandomFactor(
randomFactor):this
Defined in: src/pattern/CircuitBreakerOptions.ts:195
Jitter fraction in [0, 1] spread over the reopen window.
Parameters
Section titled “Parameters”randomFactor
Section titled “randomFactor”number
Returns
Section titled “Returns”this
withResetTimeoutMs()
Section titled “withResetTimeoutMs()”withResetTimeoutMs(
resetTimeoutMs):this
Defined in: src/pattern/CircuitBreakerOptions.ts:170
How long the breaker stays open before letting a probe through (ms).
Parameters
Section titled “Parameters”resetTimeoutMs
Section titled “resetTimeoutMs”number
Returns
Section titled “Returns”this
withScheduler()
Section titled “withScheduler()”withScheduler(
scheduler):this
Defined in: src/pattern/CircuitBreakerOptions.ts:206
Where the breaker reads the time and arms its call timeout.
Parameters
Section titled “Parameters”scheduler
Section titled “scheduler”Returns
Section titled “Returns”this
create()
Section titled “create()”
staticcreate():CircuitBreakerOptionsBuilder
Defined in: src/pattern/CircuitBreakerOptions.ts:160
Start a fresh builder.
Returns
Section titled “Returns”CircuitBreakerOptionsBuilder
