lib/scanner: Don't stop byte counter ticks before scan is done
This commit is contained in:
@@ -169,13 +169,14 @@ func (w *walker) walk() (chan protocol.FileInfo, error) {
|
||||
realToHashChan := make(chan protocol.FileInfo)
|
||||
done := make(chan struct{})
|
||||
progress := newByteCounter()
|
||||
defer progress.Close()
|
||||
|
||||
newParallelHasher(w.Dir, w.BlockSize, w.Hashers, finishedChan, realToHashChan, progress, done, w.Cancel)
|
||||
|
||||
// A routine which actually emits the FolderScanProgress events
|
||||
// every w.ProgressTicker ticks, until the hasher routines terminate.
|
||||
go func() {
|
||||
defer progress.Close()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-done:
|
||||
@@ -185,7 +186,7 @@ func (w *walker) walk() (chan protocol.FileInfo, error) {
|
||||
case <-ticker.C:
|
||||
current := progress.Total()
|
||||
rate := progress.Rate()
|
||||
l.Debugf("Walk %s %s current progress %d/%d at %.01f MB/s (%d%%)", w.Dir, w.Subs, current, total, rate/1024/1024, current*100/total)
|
||||
l.Debugf("Walk %s %s current progress %d/%d at %.01f MiB/s (%d%%)", w.Dir, w.Subs, current, total, rate/1024/1024, current*100/total)
|
||||
events.Default.Log(events.FolderScanProgress, map[string]interface{}{
|
||||
"folder": w.Folder,
|
||||
"current": current,
|
||||
|
||||
Reference in New Issue
Block a user