-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
refactor: update retry function #6451
Conversation
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.
@FaybianB Thanks for looking into this. The change looks good to me, but it would be good to check all callers of this function and see if we need to reduce retries passed by 1. I would expect it doesn't matter much for most operation but getting an overview would be great.
@nflaig Here are all the functions I've found that call the
|
Thanks @FaybianB for looking into it We should be fine to keep the 20/60 as is, but might wanna update these
I think 3 requests in total should be sufficient here, and we keep previous behavior |
Edit: Noticed this requires more changes, I will push a PR for this separately (see #6458) |
@FaybianB I noticed few more cases, we use the retry function in our http clients which are configured via e.g. default value here should probably be changed to 2
and we need to make sure to set default value here to 0 (meaning no retries by default)
(or maybe more elegant would be to not wrap call into |
@nflaig I've updated the other areas referring to I thought this was a cleaner solution than updating the
Do you agree or do you think I should update the tests instead? |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #6451 +/- ##
=========================================
Coverage 61.63% 61.63%
=========================================
Files 553 553
Lines 57974 57998 +24
Branches 1834 1837 +3
=========================================
+ Hits 35734 35749 +15
- Misses 22203 22210 +7
- Partials 37 39 +2 |
@@ -85,7 +85,7 @@ export async function downloadGenericSpecTests<TestNames extends string>( | |||
log(`Downloaded ${url}`); | |||
}, | |||
{ | |||
retries: 2, | |||
retries: 3, |
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.
This used async-retry library, keeping retries as is, to not change previous behavior
Good catch! This makes sense to me, I noticed there is another case where checking if we are at max attempts is important because otherwise, we will also sleep one more time before throwing the last error which is not ideal.
The tests are incorrect, incrementing retryCount in the last iteration is wrong as it will not do another retry. Also noticed tests use retryCount to track request count, pushed some updates to the test to fix this and make them pass. |
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.
LGTM, thanks @FaybianB for the thoroughness!
🎉 This PR is included in v1.17.0 🎉 |
Motivation
Update
retry
function.Description
Updates the
retry
function to follow a more common pattern used in other libraries such as retry and retry-request, which, ifretries=1
it will call the function and on failure retry it once.Resolves #6447
Closes #6447