-
Notifications
You must be signed in to change notification settings - Fork 713
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
Fix multipart file readers not being reset when doing a retry #549
Fix multipart file readers not being reset when doing a retry #549
Conversation
ee3cd94
to
6f83141
Compare
What about the readers that cannot be reset? |
@SVilgelm |
6f83141
to
bd01a8f
Compare
@nikplx I'm sorry for the delayed attention on the PR. Thanks for your contribution. |
5b386fa
to
c027ec0
Compare
@nikplx I'm sorry for the delayed attention on the PR. Thanks for your contribution. |
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.
@nikplx Can you please help to get the PR build validation cleared? then we can merge this PR.
Hey @jeevatkm I fixed the test stage. There was some mixup in the sum file. It now runs locally. Maybe you can retrigger the pipeline if you have some time. |
9b9a6ee
to
7990f74
Compare
Codecov Report
@@ Coverage Diff @@
## master #549 +/- ##
==========================================
- Coverage 95.94% 95.84% -0.11%
==========================================
Files 10 10
Lines 1357 1372 +15
==========================================
+ Hits 1302 1315 +13
- Misses 34 36 +2
Partials 21 21
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@nikplx This time PR validation build executed without any issue. Do you mind checking this codecov feedback? |
7990f74
to
23e9fef
Compare
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.
Thanks @nikplx 👍
As mentioned in #166 by @neganovalexey, when doing a retry on a multipart request the
io.Reader
is not reset to the start again. This can lead to subtle bugs, as the request will be retried, but the form part of the file will be empty, because the reader was already exhausted. Solving this issue in the caller code is pretty ugly, becauseRequest
does not expose access tomultipartFiles
and so the caller would have to useRetryHooks
and recreate theResponse.Request
and that at each call site (where there is access to the originalReadSeeker
).In the PR, I created a new client options
SetRetryResetReaders
which adds a retry hook seeking the start of each reader inmultipartFiles
, if the reader it got also implementsio.ReadSeeker
. This solved the above issue described above for my usecase and should have minimal implications on existing usages.