From d87a9b788b3ae273421ee1a6960689ceb2e4f256 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Tue, 7 Dec 2021 17:20:47 +0100 Subject: vendor c/image/v5@main Mainly to pull in fixes for #11636 which handles credential helpers correctly. Fixes: #11636 Signed-off-by: Valentin Rothberg --- vendor/github.com/vbauerster/mpb/v7/proxyreader.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'vendor/github.com/vbauerster/mpb/v7/proxyreader.go') diff --git a/vendor/github.com/vbauerster/mpb/v7/proxyreader.go b/vendor/github.com/vbauerster/mpb/v7/proxyreader.go index 316f438d7..2f20053bd 100644 --- a/vendor/github.com/vbauerster/mpb/v7/proxyreader.go +++ b/vendor/github.com/vbauerster/mpb/v7/proxyreader.go @@ -38,14 +38,13 @@ func (x *proxyWriterTo) WriteTo(w io.Writer) (int64, error) { type ewmaProxyReader struct { io.ReadCloser // *proxyReader bar *Bar - iT time.Time } func (x *ewmaProxyReader) Read(p []byte) (int, error) { + start := time.Now() n, err := x.ReadCloser.Read(p) if n > 0 { - x.bar.DecoratorEwmaUpdate(time.Since(x.iT)) - x.iT = time.Now() + x.bar.DecoratorEwmaUpdate(time.Since(start)) } return n, err } @@ -54,14 +53,13 @@ type ewmaProxyWriterTo struct { io.ReadCloser // *ewmaProxyReader wt io.WriterTo // *proxyWriterTo bar *Bar - iT time.Time } func (x *ewmaProxyWriterTo) WriteTo(w io.Writer) (int64, error) { + start := time.Now() n, err := x.wt.WriteTo(w) if n > 0 { - x.bar.DecoratorEwmaUpdate(time.Since(x.iT)) - x.iT = time.Now() + x.bar.DecoratorEwmaUpdate(time.Since(start)) } return n, err } @@ -71,10 +69,9 @@ func newProxyReader(r io.Reader, bar *Bar) io.ReadCloser { rc = &proxyReader{rc, bar} if wt, isWriterTo := r.(io.WriterTo); bar.hasEwmaDecorators { - now := time.Now() - rc = &ewmaProxyReader{rc, bar, now} + rc = &ewmaProxyReader{rc, bar} if isWriterTo { - rc = &ewmaProxyWriterTo{rc, wt, bar, now} + rc = &ewmaProxyWriterTo{rc, wt, bar} } } else if isWriterTo { rc = &proxyWriterTo{rc, wt, bar} -- cgit v1.2.3-54-g00ecf