Interface: RetryOptions
Defined in: shared/utils/retry.ts:46
Options controlling retry behavior for withRetry.
Propertiesโ
delayMs?โ
optionaldelayMs:number| (args: {attempt:number;error:unknown; }) =>number
Defined in: shared/utils/retry.ts:55
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:67
Maximum number of attempts (including the first attempt).
Default Valueโ
5;
onError()?โ
optionalonError: (error:unknown,attempt:number) =>void
Defined in: shared/utils/retry.ts:76
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:82
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:89
Optional label for debugging/logging by callers.
shouldRetry()?โ
optionalshouldRetry: (error:unknown,attempt:number) =>boolean
Defined in: shared/utils/retry.ts:97
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:103
When true, uses an unref'd timer for the delay between retries so the process can exit naturally.