Compare commits

..

3 Commits

1 changed files with 7 additions and 1 deletions

View File

@ -223,13 +223,16 @@ func (i *ImportReader) Close() error {
func (i *ImportReader) Read(p []byte) (n int, err error) { func (i *ImportReader) Read(p []byte) (n int, err error) {
n, err = i.reader.Read(p) n, err = i.reader.Read(p)
if err != nil { if err != nil {
if err == io.EOF {
return n, err
}
return 0, err return 0, err
} }
// Update cumulative bytes read // Update cumulative bytes read
i.bytesRead += uint64(n) i.bytesRead += uint64(n)
err = i.ReadBytes(n) err = i.ReadBytes(0)
if err != nil { if err != nil {
return 0, err return 0, err
} }
@ -238,6 +241,9 @@ func (i *ImportReader) Read(p []byte) (n int, err error) {
} }
func (i *ImportReader) ReadBytes(n int) (err error) { func (i *ImportReader) ReadBytes(n int) (err error) {
if n > 0 {
i.bytesRead += uint64(n)
}
stageProgress := float64(100) / float64(i.totalStages) stageProgress := float64(100) / float64(i.totalStages)
// Calculate progress based on bytes read // Calculate progress based on bytes read