Skip to content

Commit

Permalink
progress: set Current before Refill
Browse files Browse the repository at this point in the history
the mpb.Progress doesn't allow to set the Refill value bigger than
Current so make sure we set Current before setting Refill otherwise we
will report the wrong number of skipped bytes.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Sep 18, 2023
1 parent 13fcff5 commit 76a421e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion copy/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,9 @@ func (ic *imageCopier) copyLayer(ctx context.Context, srcInfo types.BlobInfo, to
uploadedBlob, err := ic.c.dest.PutBlobPartial(ctx, &proxy, srcInfo, ic.c.blobInfoCache)
if err == nil {
if srcInfo.Size != -1 {
bar.SetRefill(srcInfo.Size - bar.Current())
refill := srcInfo.Size - bar.Current()
bar.SetCurrent(srcInfo.Size)
bar.SetRefill(refill)
}
bar.mark100PercentComplete()
hideProgressBar = false
Expand Down

0 comments on commit 76a421e

Please sign in to comment.