Chore: reduce fetch-retry timeout

This commit is contained in:
SukkaW 2024-10-27 03:49:42 +08:00
parent a42d28195d
commit 132bdb272a

View File

@ -29,7 +29,9 @@ const agent = new Agent({
setGlobalDispatcher(agent.compose( setGlobalDispatcher(agent.compose(
interceptors.retry({ interceptors.retry({
maxRetries: 5, maxRetries: 5,
minTimeout: 10000, minTimeout: 500, // The initial retry delay in milliseconds
maxTimeout: 10 * 1000, // The maximum retry delay in milliseconds
// TODO: this part of code is only for allow more errors to be retried by default // TODO: this part of code is only for allow more errors to be retried by default
// This should be removed once https://github.com/nodejs/undici/issues/3728 is implemented // This should be removed once https://github.com/nodejs/undici/issues/3728 is implemented
// @ts-expect-error -- retry return type should be void // @ts-expect-error -- retry return type should be void
@ -58,7 +60,7 @@ setGlobalDispatcher(agent.compose(
const { const {
maxRetries = 5, maxRetries = 5,
minTimeout = 500, minTimeout = 500,
maxTimeout = 30 * 1000, maxTimeout = 10 * 1000,
timeoutFactor = 2, timeoutFactor = 2,
methods = ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'] methods = ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE']
} = retryOptions; } = retryOptions;