From da06f8c9b7b65b62351a98bd1e7da8ff3d0d2b7e Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 12 Oct 2023 05:37:35 -0700 Subject: [PATCH] Add optimization --- .../upgrade/artifact/download/http/progress_reporter.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/pkg/agent/application/upgrade/artifact/download/http/progress_reporter.go b/internal/pkg/agent/application/upgrade/artifact/download/http/progress_reporter.go index 85de47849b2..3114016d284 100644 --- a/internal/pkg/agent/application/upgrade/artifact/download/http/progress_reporter.go +++ b/internal/pkg/agent/application/upgrade/artifact/download/http/progress_reporter.go @@ -53,6 +53,11 @@ func (dp *downloadProgressReporter) Report(ctx context.Context) { length := dp.length interval := dp.interval + // If there are no observers to report progress to, there is nothing to do! + if len(dp.progressObservers) == 0 { + return + } + go func() { t := time.NewTicker(interval) defer t.Stop()