RetryOptions
Este conteúdo não está disponível em sua língua ainda.
RetryOptions =
object
Defined in: src/pattern/retry.ts:1
Properties
Section titled “Properties”attempts
Section titled “attempts”
readonlyattempts:number
Defined in: src/pattern/retry.ts:3
Total attempts including the initial call. Must be >= 1.
delayMs?
Section titled “delayMs?”
readonlyoptionaldelayMs?:number
Defined in: src/pattern/retry.ts:5
Base delay between retries, in ms.
factor?
Section titled “factor?”
readonlyoptionalfactor?:number
Defined in: src/pattern/retry.ts:7
Exponential-backoff multiplier applied to delayMs (default 1 — no backoff).
maxDelayMs?
Section titled “maxDelayMs?”
readonlyoptionalmaxDelayMs?:number
Defined in: src/pattern/retry.ts:9
Upper bound for any individual retry delay.
onAttempt?
Section titled “onAttempt?”
readonlyoptionalonAttempt?: (err,attempt) =>void
Defined in: src/pattern/retry.ts:16
Called after each failed attempt; useful for logging/metrics.
Parameters
Section titled “Parameters”Error
attempt
Section titled “attempt”number
Returns
Section titled “Returns”void
shouldRetry?
Section titled “shouldRetry?”
readonlyoptionalshouldRetry?: (err,attempt) =>boolean
Defined in: src/pattern/retry.ts:14
Predicate that decides whether a specific error is retryable. Return false to short-circuit with the final error. Defaults to “retry any”.
Parameters
Section titled “Parameters”Error
attempt
Section titled “attempt”number
Returns
Section titled “Returns”boolean
sleep?
Section titled “sleep?”
readonlyoptionalsleep?: (ms) =>Promise<void>
Defined in: src/pattern/retry.ts:25
How the delay between attempts is awaited. Defaults to setTimeout.
Override to take the retry loop off the wall clock — a
ManualScheduler-backed sleep makes the backoff schedule exact and
instant in tests, where a real timer’s ±quantum jitter makes a capped
delay indistinguishable from an uncapped one. Same escape hatch as
BackoffPolicy’s random.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Promise<void>
