Will retry on network error
parent
33577a7b24
commit
7c993cabaf
|
@ -88,8 +88,16 @@ class SessionManager {
|
|||
}
|
||||
|
||||
private retryCondition(error: AxiosError): boolean {
|
||||
// Check for network errors (e.g., socket hang up)
|
||||
const isNetworkError = !error.response && Boolean(error.code); // No response and error.code is truthy indicates a network error
|
||||
|
||||
// Check for specific HTTP status codes
|
||||
const status = error.response?.status ?? 0;
|
||||
return status === 429 || status >= 500;
|
||||
const isRateLimitError = status === 429;
|
||||
const isServerError = status >= 500;
|
||||
|
||||
// Retry on network errors, rate limit errors, or server errors
|
||||
return isNetworkError || isRateLimitError || isServerError;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue