Setting the statusCodes property on retry should ensure that only responses which match that code are retried. However I am seeing retries for statusCodes not specified.
Non 429 responses are retried.
Only 429 responses are retried
got.extend({
retry: {
limit: 5,
calculateDelay: ({ attemptCount, error }) => {
// Retry after the number of seconds specified in the "retry-after" header
const retryAfter = error.response?.headers?.["retry-after"];
if (retryAfter !== undefined)
return parseInt(retryAfter) * 1000; // Convert to milliseconds
// Default retry delay
return 1000 * attemptCount;
},
statusCodes: [429], // Retry on 429 status code
},
})
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too