Merged
Conversation
thomasrockhu-codecov
requested changes
Aug 2, 2023
Codecov Report
@@ Coverage Diff @@
## main #1098 +/- ##
==========================================
+ Coverage 92.47% 92.55% +0.08%
==========================================
Files 36 36
Lines 1342 1357 +15
Branches 272 273 +1
==========================================
+ Hits 1241 1256 +15
Misses 69 69
Partials 32 32
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Retry the requests POST to codecov and PUT to storage in case of ECONNRESET. Actually it retries in the following cases: * `errors.UndiciError` with code `'ECONNRESET'`; * `errors.ConnectTimeoutError`; * `errors.SockerError`. That is because I didn't actually know what error ECONNRESET is. I used `UndiciError` as the error base class because I noticed we use the `request` from `undici`, so I figured that if an error happens then it would probably be wrapped by the lib. Fixes #537
Increasing the retry delay and logging the error received when POSTing to Codecov. Now we will retry after 1, 2, 4 and 8 seconds (so total wait of 15s + the request times) I had to move the sleep function to another module because it's the only way I managed to mock it. I tried several different mocking arrangements but that was the one that sticked. It does have the benefit of making it reusable, so I guess it's not that bad.
bc5b63c to
06cb5bc
Compare
Retry the requests POST to codecov and PUT to storage in case of ECONNRESET. Actually it retries in the following cases: * `errors.UndiciError` with code `'ECONNRESET'`; * `errors.ConnectTimeoutError`; * `errors.SockerError`. That is because I didn't actually know what error ECONNRESET is. I used `UndiciError` as the error base class because I noticed we use the `request` from `undici`, so I figured that if an error happens then it would probably be wrapped by the lib. Fixes #537
Increasing the retry delay and logging the error received when POSTing to Codecov. Now we will retry after 1, 2, 4 and 8 seconds (so total wait of 15s + the request times) I had to move the sleep function to another module because it's the only way I managed to mock it. I tried several different mocking arrangements but that was the one that sticked. It does have the benefit of making it reusable, so I guess it's not that bad.
06cb5bc to
58b33de
Compare
test/helpers/web.test.ts
Outdated
| import { IServiceParams, PostResults, UploaderArgs, UploaderEnvs } from '../../src/types.js' | ||
| import { createEmptyArgs } from '../test_helpers' | ||
|
|
||
| import * as util_module from '../../src/helpers/util' |
Contributor
There was a problem hiding this comment.
please use utilModule, this is JS world 😆
thomasrockhu-codecov
approved these changes
Aug 8, 2023
Contributor
thomasrockhu-codecov
left a comment
There was a problem hiding this comment.
Pending var change
webknjaz
reviewed
Sep 26, 2023
| } catch (error: unknown) { | ||
| if ( | ||
| ((error instanceof errors.UndiciError && error.code == 'ECONNRESET') || | ||
| error instanceof errors.ConnectTimeoutError || |
Contributor
There was a problem hiding this comment.
Looks like this doesn't catch ETIMEDOUT.
Contributor
|
@giovanni-guidini apparently, this doesn't cover all the cases. See: #1180. |
thomasrockhu-codecov
pushed a commit
that referenced
this pull request
Oct 10, 2023
Retry the requests POST to codecov and PUT to storage in case of ECONNRESET. Actually it retries in the following cases: * `errors.UndiciError` with code `'ECONNRESET'`; * `errors.ConnectTimeoutError`; * `errors.SockerError`. That is because I didn't actually know what error ECONNRESET is. I used `UndiciError` as the error base class because I noticed we use the `request` from `undici`, so I figured that if an error happens then it would probably be wrapped by the lib. We will retry after 1, 2, 4 and 8 seconds (so total wait of 15s + the request times) I had to move the sleep function to another module because it's the only way I managed to mock it. I tried several different mocking arrangements but that was the one that sticked. It does have the benefit of making it reusable, so I guess it's not that bad. Fixes #537
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Retry the requests POST to codecov and PUT to storage in case of ECONNRESET. Actually it retries in the following cases:
errors.UndiciErrorwith code'ECONNRESET';errors.ConnectTimeoutError;errors.SockerError.That is because I didn't actually know what error ECONNRESET is. I used
UndiciErroras the error base class because I noticed we use therequestfromundici, so I figured that if an error happens then it would probably be wrapped by the lib.Fixes #537