diff --git a/src/internal/connector/sharepoint/collection.go b/src/internal/connector/sharepoint/collection.go index 458be0a74..ac41fb501 100644 --- a/src/internal/connector/sharepoint/collection.go +++ b/src/internal/connector/sharepoint/collection.go @@ -149,7 +149,7 @@ func (sc *Collection) finishPopulation(ctx context.Context, attempts, success in status := support.CreateStatus( ctx, support.Backup, - len(sc.jobs), + 1, // 1 folder support.CollectionMetrics{ Objects: attempted, Successes: success, @@ -172,6 +172,9 @@ func (sc *Collection) populate(ctx context.Context) { writer = kw.NewJsonSerializationWriter() ) + defer func() { + sc.finishPopulation(ctx, metrics.attempts, metrics.success, int64(metrics.success), errs) + }() // TODO: Insert correct ID for CollectionProgress colProgress, closer := observe.CollectionProgress( ctx, @@ -182,7 +185,6 @@ func (sc *Collection) populate(ctx context.Context) { defer func() { close(colProgress) - sc.finishPopulation(ctx, metrics.attempts, metrics.success, metrics.totalBytes, errs) }() // Switch retrieval function based on category