Documentation
    Preparing search index...

    Interface PollOptions

    interface PollOptions {
        interval?: number | ((context: PollContext) => number | Promise<number>);
        limit?: number;
        shouldPoll?: (context: ShouldPollContext) => boolean | Promise<boolean>;
        statusCodes?: number[];
    }
    Index
    interval?: number | ((context: PollContext) => number | Promise<number>)

    The delay between polling attempts in milliseconds.

    1000
    
    limit?: number

    The maximum number of pollable responses before returning the last response.

    When retry is also enabled, the limit applies per retry attempt, not overall. A retry restarts polling from the first request with a fresh counter, so the worst case is (retries + 1) × limit requests. The default timeout is sized for that worst case, and an explicit timeout covers all of them.

    10
    
    shouldPoll?: (context: ShouldPollContext) => boolean | Promise<boolean>

    Decide whether to poll again. Called for every successful response, and its return value replaces the built-in check (statusCodes).

    context.defaultShouldPoll holds the built-in decision, so return it to keep the default behavior. Returning false stops polling and returns the current response. limit still applies.

    Type Declaration

      • (context: ShouldPollContext): boolean | Promise<boolean>
      • Parameters

        Returns boolean | Promise<boolean>

        • Whether to continue polling
    statusCodes?: number[]

    The HTTP status codes that should trigger polling. Status codes in the range 200-299.

    [202]