From 5ccf583b8a2c6719ea424d0b9dfe1d1dcc186fdc Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Wed, 18 Aug 2021 01:27:22 +0200 Subject: [PATCH] ui: restore a few comments --- internal/ui/progress.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/ui/progress.go b/internal/ui/progress.go index 5a9581419..19a2be8dc 100644 --- a/internal/ui/progress.go +++ b/internal/ui/progress.go @@ -65,6 +65,7 @@ type Summary struct { archiver.ItemStats } +// Progress reports progress for the `backup` command. type Progress struct { MinUpdatePause time.Duration @@ -100,6 +101,8 @@ func NewProgress(printer ProgressPrinter) *Progress { } } +// Run regularly updates the status lines. It should be called in a separate +// goroutine. func (p *Progress) Run(ctx context.Context) error { var ( lastUpdate time.Time @@ -309,9 +312,9 @@ func (p *Progress) ReportTotal(item string, s archiver.ScanStats) { // Finish prints the finishing messages. func (p *Progress) Finish(snapshotID restic.ID) { + // wait for the status update goroutine to shut down <-p.closed - summary := p.summary - p.printer.Finish(snapshotID, p.start, summary) + p.printer.Finish(snapshotID, p.start, p.summary) } // SetMinUpdatePause sets b.MinUpdatePause. It satisfies the