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

@ -176,22 +176,30 @@ func (col Collection) DoNotMergeItems() bool {
// all the M365IDs defined in the added field. data channel is closed by this function // all the M365IDs defined in the added field. data channel is closed by this function
func (col *Collection) streamItems(ctx context.Context) { func (col *Collection) streamItems(ctx context.Context) {
var ( var (
errs error errs error
success int64 success int64
totalBytes int64 totalBytes int64
wg sync.WaitGroup wg sync.WaitGroup
colProgress chan<- struct{}
user = col.user user = col.user
) )
colProgress, closer := observe.CollectionProgress(user, col.fullPath.Category().String(), col.fullPath.Folder())
go closer()
defer func() { defer func() {
close(colProgress)
col.finishPopulation(ctx, int(success), totalBytes, errs) 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 // get QueryBasedonIdentifier
// verify that it is the correct type in called function // verify that it is the correct type in called function
// serializationFunction // serializationFunction
@ -228,7 +236,9 @@ func (col *Collection) streamItems(ctx context.Context) {
atomic.AddInt64(&success, 1) atomic.AddInt64(&success, 1)
atomic.AddInt64(&totalBytes, 0) atomic.AddInt64(&totalBytes, 0)
colProgress <- struct{}{} if colProgress != nil {
colProgress <- struct{}{}
}
}(id) }(id)
} }
@ -282,7 +292,9 @@ func (col *Collection) streamItems(ctx context.Context) {
atomic.AddInt64(&success, 1) atomic.AddInt64(&success, 1)
atomic.AddInt64(&totalBytes, int64(byteCount)) atomic.AddInt64(&totalBytes, int64(byteCount))
colProgress <- struct{}{} if colProgress != nil {
colProgress <- struct{}{}
}
}(id) }(id)
} }

View File

@ -344,6 +344,7 @@ func CollectionProgress(user, category, dirName string) (chan<- struct{}, func()
decor.CurrentNoUnit("%d - ", decor.WCSyncSpace), decor.CurrentNoUnit("%d - ", decor.WCSyncSpace),
decor.Name(fmt.Sprintf("%s - %s", user, dirName)), decor.Name(fmt.Sprintf("%s - %s", user, dirName)),
), ),
mpb.BarFillerOnComplete(spinFrames[0]),
} }
if !cfg.keepBarsAfterComplete { if !cfg.keepBarsAfterComplete {

View File

@ -255,13 +255,6 @@ func produceManifestsAndMetadata(
tenantID string, tenantID string,
getMetadata bool, getMetadata bool,
) ([]*kopia.ManifestEntry, []data.Collection, error) { ) ([]*kopia.ManifestEntry, []data.Collection, error) {
complete, closer := observe.MessageWithCompletion("Fetching backup heuristics:")
defer func() {
complete <- struct{}{}
close(complete)
closer()
}()
var ( var (
metadataFiles = graph.AllMetadataFileNames() metadataFiles = graph.AllMetadataFileNames()
collections []data.Collection collections []data.Collection