Skip to content

Commit

Permalink
fix: retry only on specific 5xx errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Sep 4, 2024
1 parent 38bc185 commit 9143992
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/fetcher/requestWithRetries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function requestWithRetries(
let response: Response = await requestFn();

for (let i = 0; i < maxRetries; ++i) {
if ([408, 409, 429].includes(response.status) || response.status >= 500) {
if ([408, 429, 502, 503, 504].includes(response.status)) {
const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
await new Promise((resolve) => setTimeout(resolve, delay));
response = await requestFn();
Expand Down

0 comments on commit 9143992

Please sign in to comment.