-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add (configurable) auto retry when getting Network errors #167
Conversation
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
fn() | ||
, { | ||
minTimeout: this.retryIntervalMs, | ||
retries: this.retryMaxAttempts - 1 - 1, // Two `-1` because we already did two tries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work if retryMaxAttempts is 0, 1 or 2?
await timeout(this.retryIntervalMs); | ||
try { | ||
const retriedResult = await retry<T>( | ||
async () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is async needed?
fn() | ||
, { | ||
minTimeout: this.retryIntervalMs, | ||
retries: this.retryMaxAttempts - 1 - 1, // Two `-1` because we already did two tries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If retryMaxAttempts is 2, we should do total of 3 fetches, right? One fetch and 2 retries. Not sure "- 1 - 1" is correct then, looks like "- 1" is enough?
Closes #165