Skip to content

Commit

Permalink
Merge pull request #45 from JupiterOne/INT-11348-stop-retrying-404
Browse files Browse the repository at this point in the history
Stop retrying 404
  • Loading branch information
Gonzalo-Avalos-Ribas authored Aug 5, 2024
2 parents 537a4aa + 5890f1c commit 369577c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ms-graph/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,12 @@ export class GraphClient {
): Promise<GraphClientResponse<T> | undefined> {
return retry(() => this.callApi<T>({ link, query }), {
maxAttempts: 3,
delay: 30_000,
delay: 15_000,
timeout: 360_000,
factor: 2,
handleError: async (error: GraphErrorExtended, attemptContext) => {
// We should only abort on errors that aren't recoverable. Some endpoints
// have peroidically returned 404 - Not Found errors and have had success
// on subsequent attempts.
if ([403, 401].includes(error.statusCode)) {
// Retrying 404 is expensive, for resources we are not sure exist. Stop retrying.
if ([404, 403, 401].includes(error.statusCode)) {
attemptContext.abort();
}

Expand Down

0 comments on commit 369577c

Please sign in to comment.