stats: keep progress counters across snapshots

The file, blob and size counters were reset for every snapshot, so the
progress line only reflected the last processed snapshot.

Co-authored-by: Winfried Plappert <18740761+wplapper@users.noreply.github.com>
This commit is contained in:
Junker der ProvinzandWinfried Plappert committed 2026-10-21 22:44:24 +02:00
1 parent dd09b6bd01
commit 84c2d0223f
3 files changed
+12 -6

No files matched your search

-3
View File
@@ -88,7 +88,4 @@ func (p *Progress) ProcessSnapshot() {
defer p.m.Unlock()
p.processedSnapshotCount++
p.processedFileCount = 0
p.processedBlobCount = 0
p.processedSize = 0
}
+3 -3
View File
@@ -24,14 +24,14 @@ func TestStatsProgress(t *testing.T) {
progress.ProcessSnapshot()
progress.printProgress(10*time.Second, false)
rtest.Equals(t, []string{"[0:10] 50.00% 2 / 2 snapshots, 0 B"}, term.Output)
rtest.Equals(t, []string{"[0:10] 50.00% 2 / 2 snapshots, 1 files, 2 blobs, 3 B"}, term.Output)
progress.Update(4, 5, 6)
progress.printProgress(15*time.Second, false)
rtest.Equals(t, []string{"[0:15] 50.00% 2 / 2 snapshots, 4 files, 5 blobs, 6 B"}, term.Output)
rtest.Equals(t, []string{"[0:15] 50.00% 2 / 2 snapshots, 5 files, 7 blobs, 9 B"}, term.Output)
progress.printProgress(20*time.Second, true)
rtest.Equals(t, []string{"[0:20] 100.00% 2 / 2 snapshots, 4 files, 5 blobs, 6 B"}, term.Output)
rtest.Equals(t, []string{"[0:20] 100.00% 2 / 2 snapshots, 5 files, 7 blobs, 9 B"}, term.Output)
}
func TestStatsProgressJSON(t *testing.T) {