qfetch
    Preparing search index...

    Type Alias RetryAfterOptions

    Configuration options for the withRetryAfter middleware.

    This middleware handles server-directed retry timing. When a server responds with 429 or 503 and a valid Retry-After header, the middleware waits the specified duration before retrying. The backoff strategy adds optional jitter on top of the server-requested delay.

    type RetryAfterOptions = {
        maxServerDelay?: number;
        retryableStatuses?: ReadonlySet<number>;
        strategy: () => BackoffStrategy;
    }
    Index

    Properties

    maxServerDelay?: number

    Maximum delay in milliseconds accepted from the server for a single retry.

    Enforces a ceiling on the Retry-After delay. Throws ConstraintError if exceeded.

    undefined (unlimited)
    
    retryableStatuses?: ReadonlySet<number>

    Set of HTTP status codes that should trigger automatic retries.

    Defaults to the standard retryable status codes: 429, 503. Override this to customize which status codes should be retried.

    new Set([429, 503])
    
    strategy: () => BackoffStrategy

    Factory function that creates a backoff strategy for retry delays.

    The strategy determines additional jitter to add to the Retry-After delay and when to stop retrying (by returning NaN). Total wait time is Retry-After + strategy.nextBackoff(). Wrap with upto() to limit retry attempts.

    import { fullJitter, upto } from "@proventuslabs/retry-strategies";

    strategy: () => upto(3, fullJitter(100, 10_000))