Skip to main content

runWithRetry

@retinue/monorepo


@retinue/monorepo / backend/src / runWithRetry

Function: runWithRetry()

runWithRetry<T>(input): Promise<T>

Defined in: backend/src/runtime/retry.ts:137

Run operation with the retry policy. operation receives the 1-based attempt number and MUST be safe to repeat (provider call, or an idempotent tool). Between attempts onRetryPending fires so the worker can persist a retry-pending status and publish a run.retry-pending event, then sleep waits out the backoff. Exhausting the budget rethrows the last error unchanged.

Type Parameters​

T​

T

Parameters​

input​

now​

() => number

onRetryPending?​

(info) => void | Promise<void>

operation​

(attempt) => Promise<T>

policy?​

RetryPolicy

random?​

() => number

sleep​

(ms) => Promise<void>

startAttempt?​

number

Returns​

Promise<T>