Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface YafetchPluginRetryOptions

description

Retry options for this plugin

Hierarchy

  • YafetchPluginRetryOptions

Index

Properties

delay?: number | ((attempt: number, err?: Error, response?: YafetchPluginRetryResponse) => number)
description

Retry delay in seconds or a function that returns the delay seconds. Only works in manual mode

default

10

maxRetries?: number
description

When to stop retrying and return the last response, if any

default

3

mode?: "manual" | "header"
description

manual mode allows you to control the retry logic on the client-side while header mode will work with the HTTP header that's returned by the server

see

Retry-After

default

header

Methods

  • description

    Optional hook to execute before each retry. Can cancel the call by returning false.

    Parameters

    • attempt: number

      Count of this retry attempt

    • Optional err: Error

      The reason for retrying again

    • Optional response: YafetchPluginRetryResponse

      Response object if the API returned one

    Returns boolean | Promise<boolean>

    A boolean that will decide if the next retry should happen or not. Can be a promise which is automatically awaited. This is useful when you need to wait for a condition before the next retry happens. E.g. network connectivity.

Generated using TypeDoc