Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Retry on ETIMEDOUT timeout #171

Merged
merged 1 commit into from
Oct 8, 2020
Merged

Retry on ETIMEDOUT timeout #171

merged 1 commit into from
Oct 8, 2020

Conversation

ehmicky
Copy link
Contributor

@ehmicky ehmicky commented Oct 8, 2020

Fixes #166.

When the TCP connection or HTTP request times out, an error with code: 'ETIMEDOUT' is usually thrown by node-fetch (as opposed to returning a 4** or 5**` error response).

This PR retries the request up to 10 times, with a fixed 5 seconds between each request. After that, it gives and propagate the ETIMEDOUT error.

@ehmicky ehmicky added the type: bug code to address defects in shipped code label Oct 8, 2020
@ehmicky ehmicky requested a review from erezrokah October 8, 2020 19:14
@ehmicky ehmicky self-assigned this Oct 8, 2020
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't say I like this retry logic, but it is out of scope for this PR.

A backoff would be nice and a way to configure it and log it

@ehmicky
Copy link
Contributor Author

ehmicky commented Oct 8, 2020

Yes, absolutely, this could be much better.
I think it might interesting to use libraries for this too. For example, got has some rather intricate retry logic out-of-the-box.

@ehmicky ehmicky merged commit 496193e into master Oct 8, 2020
@ehmicky ehmicky deleted the feat/add-retry-on-timeout branch October 8, 2020 20:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retry request on ETIMEDOUT
2 participants