Skip to content

Commit

Permalink
fix: 🐛 Tweak retry in Hooks lib to exponential with 7 retries
Browse files Browse the repository at this point in the history
  • Loading branch information
whyer committed Apr 24, 2022
1 parent 1731d16 commit 5577c7f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/hooks/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export const apiMiddleware: IMiddleware =
}
storeApi.dispatch(errorAction)

// Retry 3 times
if (retries < 3) {
// Retry 7 times
if (retries < 7) {
const retryAction: EntityAction<any> = {
...action,
type: 'GET_FROM_API',
Expand All @@ -63,7 +63,7 @@ export const apiMiddleware: IMiddleware =
}
setTimeout(() => {
storeApi.dispatch(retryAction)
}, retries * 500)
}, 2 ** retries * 100)
}
})
}
Expand Down

0 comments on commit 5577c7f

Please sign in to comment.