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 

## Type of change

- [ ] 🐹 Trivial/Minor

## Issue(s)

* #1984

## Test Plan

- [x] 💪 Manual
This commit is contained in:
Keepers 2023-01-03 16:22:20 -07:00 committed by GitHub
parent ce1f4406f1
commit 1586ed927b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 17 deletions

View File

@ -180,17 +180,25 @@ func (col *Collection) streamItems(ctx context.Context) {
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())
defer func() {
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)
col.finishPopulation(ctx, int(success), totalBytes, errs)
}()
}
// get QueryBasedonIdentifier
// verify that it is the correct type in called function
@ -228,7 +236,9 @@ func (col *Collection) streamItems(ctx context.Context) {
atomic.AddInt64(&success, 1)
atomic.AddInt64(&totalBytes, 0)
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))
if colProgress != nil {
colProgress <- struct{}{}
}
}(id)
}

View File

@ -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 {

View File

@ -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