Sanity Library Reference Docs
    Preparing search index...
    EffectRetry: {
        attempts: number;
        backoff?: EffectRetryBackoff;
        expiryMs?: number;
    } & { kind: EffectRetryKind }

    A bounded retry policy for one effect. Both bounds govern one drain's run of the policy, not the effect's lifetime: a drainer that dies mid-run leaves the entry for the next drain, which starts a fresh run with the full budget, so an effect can see more handler calls in total than attempts.

    attempts is the total number of attempts in a run, the first included, so 1 means "never retry".

    expiryMs and the backoff a policy accumulates are each capped at 366 days (31_622_400_000 ms), inclusive. Deploy refuses a policy declaring more, and one whose accumulated backoff reaches its own expiryMs before its attempts are spent. Those checks weigh the declared waits alone. At runtime every elapsed millisecond counts against expiryMs, handler time included, so a slow handler can leave attempts unused. backoff paces them; omitting it retries with no wait. Every duration is a whole number of milliseconds above zero, and attempts a whole count above zero; deploy rejects anything else.

    expiryMs decides whether a further attempt may start, measured from the moment this run dispatched its first attempt. The window closes on reaching it, so an attempt is admitted only while less than expiryMs has elapsed. It is not a handler timeout. An attempt already running is never interrupted, so a run can finish after the window, and a success then still counts. Omitting it leaves attempts as the only bound.

    A policy that runs out of attempts, or that expiryMs stops, completes the effect as failed, and $effectStatus['<name>'] == 'failed' routes the instance. A successful attempt completes it as done, whichever attempt succeeded. An effect with no retry completes as failed on its handler's first failure.