From 1586ed927b5c68e78d0e45120e35759529d05d60 Mon Sep 17 00:00:00 2001 From: Keepers Date: Tue, 3 Jan 2023 16:22:20 -0700 Subject: [PATCH] remove 0-item progress bars (#1986) ## Description Incremental backups can display progress bars with 0 items to add or remove. This can cause end-user confusion when hte bar completes with 0 items involved. We should instead keep those bars hidden. Also removes the "heuristics" progress step. ## Does this PR need a docs update or release note? - [x] :no_entry: No ## Type of change - [ ] :hamster: Trivial/Minor ## Issue(s) * #1984 ## Test Plan - [x] :muscle: Manual --- .../exchange/exchange_data_collection.go | 32 +++++++++++++------ src/internal/observe/observe.go | 1 + src/internal/operations/backup.go | 7 ---- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/internal/connector/exchange/exchange_data_collection.go b/src/internal/connector/exchange/exchange_data_collection.go index 7ff76500c..0731e92d8 100644 --- a/src/internal/connector/exchange/exchange_data_collection.go +++ b/src/internal/connector/exchange/exchange_data_collection.go @@ -176,22 +176,30 @@ func (col Collection) DoNotMergeItems() bool { // all the M365IDs defined in the added field. data channel is closed by this function func (col *Collection) streamItems(ctx context.Context) { var ( - errs error - success int64 - totalBytes int64 - wg sync.WaitGroup + errs error + success int64 + totalBytes int64 + wg sync.WaitGroup + colProgress chan<- struct{} user = col.user ) - colProgress, closer := observe.CollectionProgress(user, col.fullPath.Category().String(), col.fullPath.Folder()) - go closer() - defer func() { - close(colProgress) col.finishPopulation(ctx, int(success), totalBytes, errs) }() + if len(col.added)+len(col.removed) > 0 { + var closer func() + colProgress, closer = observe.CollectionProgress(user, col.fullPath.Category().String(), col.fullPath.Folder()) + + go closer() + + defer func() { + close(colProgress) + }() + } + // get QueryBasedonIdentifier // verify that it is the correct type in called function // serializationFunction @@ -228,7 +236,9 @@ func (col *Collection) streamItems(ctx context.Context) { atomic.AddInt64(&success, 1) atomic.AddInt64(&totalBytes, 0) - colProgress <- struct{}{} + if colProgress != nil { + colProgress <- struct{}{} + } }(id) } @@ -282,7 +292,9 @@ func (col *Collection) streamItems(ctx context.Context) { atomic.AddInt64(&success, 1) atomic.AddInt64(&totalBytes, int64(byteCount)) - colProgress <- struct{}{} + if colProgress != nil { + colProgress <- struct{}{} + } }(id) } diff --git a/src/internal/observe/observe.go b/src/internal/observe/observe.go index 1e27794d2..9dd9a68fa 100644 --- a/src/internal/observe/observe.go +++ b/src/internal/observe/observe.go @@ -344,6 +344,7 @@ func CollectionProgress(user, category, dirName string) (chan<- struct{}, func() decor.CurrentNoUnit("%d - ", decor.WCSyncSpace), decor.Name(fmt.Sprintf("%s - %s", user, dirName)), ), + mpb.BarFillerOnComplete(spinFrames[0]), } if !cfg.keepBarsAfterComplete { diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index 9f6571213..569de7d60 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -255,13 +255,6 @@ func produceManifestsAndMetadata( tenantID string, getMetadata bool, ) ([]*kopia.ManifestEntry, []data.Collection, error) { - complete, closer := observe.MessageWithCompletion("Fetching backup heuristics:") - defer func() { - complete <- struct{}{} - close(complete) - closer() - }() - var ( metadataFiles = graph.AllMetadataFileNames() collections []data.Collection