firefly-limiter - v1.0.1
    Preparing search index...

    Interface RetryOptions

    Configuration for retry.

    interface RetryOptions {
        attempts: number;
        backoff: Backoff;
        budget?: RetryBudget;
        clock?: Clock;
        maxElapsed?: number;
        onEvent?: EventSink;
        shouldRetry: RetryPredicate;
    }
    Index
    attempts: number

    Total attempts, not additional ones: 1 never retries.

    backoff: Backoff

    How long to wait between them.

    budget?: RetryBudget

    Ceiling on retries across every call sharing it, so a failing dependency does not get several times its usual traffic.

    clock?: Clock

    Defaults to the system clock.

    maxElapsed?: number

    Budget for the whole operation, measured from the first attempt.

    A retry is abandoned when its backoff would carry the call past the budget, so the last failure is reported at that point rather than waited out first. A timeout below this policy also shortens its deadline to whatever is left, so no attempt overshoots the budget it started under.

    onEvent?: EventSink

    Receives an attempt event per try and a retry event per wait.

    shouldRetry: RetryPredicate

    Whether a failure is worth repeating, called with the error and the number of the attempt that produced it.

    There is no default. Whether a rejection is worth repeating is the one thing this package cannot know (a 409 is fatal to one caller and expected by another), and a guess made here would be a guess nobody can remove. retryAnything is the answer when the layer below has already classified.