Interface: RetryOptions
Defined in: shared/utils/retry.ts:47
Options controlling retry behavior for withRetry.
Propertiesโ
delayMs?โ
optionaldelayMs?:number| ((args: {attempt:number;error:unknown; }) =>number)
Defined in: shared/utils/retry.ts:56
Delay between attempts in milliseconds.
Remarksโ
Can be a constant or a function for exponential backoff / jitter.
Default Valueโ
300;
maxRetries?โ
optionalmaxRetries?:number
Defined in: shared/utils/retry.ts:68
Maximum number of attempts (including the first attempt).
Default Valueโ
5;
onError?โ
optionalonError?: (error:unknown,attempt:number) =>void
Defined in: shared/utils/retry.ts:77
Optional hook invoked after a failed attempt.
Parametersโ
errorโ
unknown
attemptโ
number
Returnsโ
void
Remarksโ
Errors thrown by this callback are swallowed to avoid masking the original failure.
onFailedAttempt?โ
optionalonFailedAttempt?: (args: {attempt:number;delayMs:number;error:unknown; }) =>void
Defined in: shared/utils/retry.ts:83
Optional hook invoked after a failed attempt and after the delay for the next attempt is computed.
Parametersโ
argsโ
attemptโ
number
delayMsโ
number
errorโ
unknown
Returnsโ
void
operationName?โ
optionaloperationName?:string
Defined in: shared/utils/retry.ts:90
Optional label for debugging/logging by callers.
shouldRetry?โ
optionalshouldRetry?: (error:unknown,attempt:number) =>boolean
Defined in: shared/utils/retry.ts:98
Optional predicate to stop retrying for specific errors.
Parametersโ
errorโ
unknown
attemptโ
number
Returnsโ
boolean
Remarksโ
Returning false stops retrying and rethrows the most recent error.
unrefDelay?โ
optionalunrefDelay?:boolean
Defined in: shared/utils/retry.ts:104
When true, uses an unref'd timer for the delay between retries so the process can exit naturally.