Skip to content

Commit

Permalink
extend retry backoff (#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbronco authored Sep 17, 2024
1 parent 5ea8f51 commit eb9c4fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/sources/subgraphs/retry-on-failure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export async function retryOnFailureWithRotation<T>(
currentSdkIndex = (currentSdkIndex + 1) % sdkClients.length;
console.log(`Retrying with URL from index ${currentSdkIndex}...`);
if (error.message.includes('429')) {
// Sleep for x seconds if the error is a 429
await new Promise((resolve) => setTimeout(resolve, 5000 * attempts));
// Sleep for x seconds if the error is a 429, would be better to use the Retry-After header
await new Promise((resolve) => setTimeout(resolve, 10000 * attempts));
}
} else {
throw new Error('All SDK clients failed after retries.');
Expand Down

0 comments on commit eb9c4fe

Please sign in to comment.