Merge pull request #4436 from ollama/mxyng/done-part

return on part done
This commit is contained in:
Michael Yang 2024-05-15 17:16:24 -07:00 committed by GitHub
commit 84ed77cbd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -221,7 +221,7 @@ func (b *blobDownload) downloadChunk(ctx context.Context, requestURL *url.URL, w
}
defer resp.Body.Close()
n, err := io.Copy(w, io.TeeReader(resp.Body, part))
n, err := io.CopyN(w, io.TeeReader(resp.Body, part), part.Size)
if err != nil && !errors.Is(err, context.Canceled) && !errors.Is(err, io.ErrUnexpectedEOF) {
// rollback progress
b.Completed.Add(-n)