AniLink - v3.1.0
    Preparing search index...

    Function computeNextRetryDelay

    • Computes the delay before the next retry, or null when the request must surface the failure instead. Before the per-error-class matrix in getRetryDelay, a failed half-open probe surfaces immediately, disabled policies never retry, and unsafe operations stop on ambiguous network or 5xx failures unless explicitly enabled. An exhausted retry budget also stops the retry, as does a server-dictated delay (a Retry-After header, or the rateLimit.reset metadata carried by both HTTP-level and GraphQL-envelope 429s) longer than the budget window's remaining time.

      The window gate applies only to server-dictated delays, the only candidate delays that can park a caller for up to a full minute per retry. Client-chosen jittered backoff delays are never gated by the window: they are already bounded by the policy's maxDelayMs cap, so they cannot stretch one window's retry spend across many minutes of wall-clock waits. The gate compares the un-clamped server-dictated deadline (see getUnclampedRetryAfterDelay and getUnclampedRateLimitResetDelay): a delay that outlasts the window surfaces immediately, instead of retrying into repeated clamped 60-second hops that each spend a budget unit. Like the count gate, the window gate requires both halves of the budget (the live state and the configuration) and spends no budget unit when it surfaces the failure.

      Parameters

      Returns number | null

      The delay in milliseconds, or null to stop retrying.