forked from TrueCloudLab/restic
backup: fix stuck status bar
The status bar got stuck once the first error was reported, the scanner completed or some file was backed up. Either case sets a flag that the scanner has started. This flag is used to hide the progress bar until the flag is set. Due to an inverted condition, the opposite happened and the status stopped refreshing once the flag was set. In addition, the scannerStarted flag was not set when the scanner just reported progress information.
This commit is contained in:
parent
59a90943bb
commit
9354262b1b
1 changed files with 2 additions and 3 deletions
|
@ -102,7 +102,7 @@ func (p *Progress) Run(ctx context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
if p.scanStarted {
|
if !p.scanStarted {
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -231,11 +231,10 @@ func (p *Progress) ReportTotal(item string, s archiver.ScanStats) {
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
|
|
||||||
p.total = Counter{Files: uint64(s.Files), Dirs: uint64(s.Dirs), Bytes: s.Bytes}
|
p.total = Counter{Files: uint64(s.Files), Dirs: uint64(s.Dirs), Bytes: s.Bytes}
|
||||||
|
p.scanStarted = true
|
||||||
|
|
||||||
if item == "" {
|
if item == "" {
|
||||||
p.printer.ReportTotal(item, p.start, s)
|
p.printer.ReportTotal(item, p.start, s)
|
||||||
p.scanStarted = true
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue