An object representing limit, calculateDelay, methods, statusCodes, maxRetryAfter and errorCodes fields for maximum retry count, retry handler, allowed methods, allowed status codes, maximum Retry-After time and allowed error codes.
Delays between retries counts with function 1000 * Math.pow(2, retry) + Math.random() * 100, where retry is attempt number (starts from 1).
The calculateDelay property is a function that receives an object with attemptCount, retryOptions, error and computedValue properties for current retry count, the retry options, error and default computed value.
The function must return a delay in milliseconds (or a Promise resolving with it) (0 return value cancels retry).
By default, it retries only on the specified methods, status codes, and on these network errors:
ETIMEDOUT: One of the timeout limits were reached.
ECONNRESET: Connection was forcibly closed by a peer.
EADDRINUSE: Could not bind to any free port.
ECONNREFUSED: Connection was refused by the server.
EPIPE: The remote side of the stream being written has been closed.
ENOTFOUND: Couldn't resolve the hostname to an IP address.
ENETUNREACH: No internet connection.
EAI_AGAIN: DNS lookup timed out.
Note: Got does not retry on POST by default.
Note: If maxRetryAfter is set to undefined, it will use options.timeout.
Note: If Retry-After header is greater than maxRetryAfter, it will cancel the request.
An object representing
limit,calculateDelay,methods,statusCodes,maxRetryAfteranderrorCodesfields for maximum retry count, retry handler, allowed methods, allowed status codes, maximumRetry-Aftertime and allowed error codes.Delays between retries counts with function
1000 * Math.pow(2, retry) + Math.random() * 100, whereretryis attempt number (starts from 1).The
calculateDelayproperty is afunctionthat receives an object withattemptCount,retryOptions,errorandcomputedValueproperties for current retry count, the retry options, error and default computed value. The function must return a delay in milliseconds (or a Promise resolving with it) (0return value cancels retry).By default, it retries only on the specified methods, status codes, and on these network errors:
ETIMEDOUT: One of the timeout limits were reached.ECONNRESET: Connection was forcibly closed by a peer.EADDRINUSE: Could not bind to any free port.ECONNREFUSED: Connection was refused by the server.EPIPE: The remote side of the stream being written has been closed.ENOTFOUND: Couldn't resolve the hostname to an IP address.ENETUNREACH: No internet connection.EAI_AGAIN: DNS lookup timed out.Note: Got does not retry on
POSTby default. Note: IfmaxRetryAfteris set toundefined, it will useoptions.timeout. Note: IfRetry-Afterheader is greater thanmaxRetryAfter, it will cancel the request.