-
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
Update object Put to avoid loosing last chunk #995
Conversation
Hello @tinou98 , thank you for the contribution! While you're right in that we should process the leftover bytes in case of EOF, I have a couple of comments:
After those changes, the flow would look something like this:
WDYT? |
Updated to match the flow you described. |
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
Can we squash this done to one CL? |
You should be able to Squash & Merge from GitHub UI, otherwise I can Squash & Force Push on my branch |
Would you mind squashing and force push? |
The old code might miss the last object if `Reader` return both a value and `EOF` Extract from `Reader` doc : > When Read encounters an error or end-of-file condition after successfully reading n > 0 bytes, it returns the number of bytes read. It may return the (non-nil) error from the same call or return the error (and n == 0) from a subsequent call. An instance of this general case is that a Reader returning a non-zero number of bytes at the end of the input stream may return either err == EOF or err == nil. The next Read should return 0, EOF. > > Callers should always process the n > 0 bytes returned before considering the error err. Doing so correctly handles I/O errors that happen after reading some bytes and also both of the allowed EOF behaviors.
Squashed |
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 for the contribution.
The old code might miss the last object if
Reader
return both a value andEOF
Extract from
Reader
doc :