From 0a508686e8be494bde487d50ac1cb05ba0b3f409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Tue, 23 Aug 2022 17:18:17 +0200 Subject: [PATCH] c8d/progress: Fix progress not ending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a bug which makes the progress handler never ending if an error happens before any ongoing is added. Signed-off-by: Paweł Gronowski --- daemon/containerd/progress.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/daemon/containerd/progress.go b/daemon/containerd/progress.go index d159a76d1d5a8..81e039b6fe7a6 100644 --- a/daemon/containerd/progress.go +++ b/daemon/containerd/progress.go @@ -29,7 +29,6 @@ func showProgress(ctx context.Context, ongoing *jobs, w io.Writer, updateFunc up out = streamformatter.NewJSONProgressOutput(w, false) ticker = time.NewTicker(100 * time.Millisecond) start = time.Now() - done bool ) for _, j := range ongoing.Jobs() { @@ -54,12 +53,9 @@ func showProgress(ctx context.Context, ongoing *jobs, w io.Writer, updateFunc up logrus.WithError(err).Error("Updating progress failed") return } - - if done { - return - } case <-ctx.Done(): - done = true + updateFunc(ctx, ongoing, out, start) + return } } }()