diff --git a/bar.go b/bar.go index 5f81412..e50a8e7 100644 --- a/bar.go +++ b/bar.go @@ -460,12 +460,15 @@ } func (b *Bar) tryEarlyRefresh(renderReq chan<- time.Time) { - var anyOtherRunning bool + var otherRunning int b.container.traverseBars(func(bar *Bar) bool { - anyOtherRunning = b != bar && bar.IsRunning() - return anyOtherRunning + if b != bar && bar.IsRunning() { + otherRunning++ + return false // stop traverse + } + return true // continue traverse }) - if !anyOtherRunning { + if otherRunning == 0 { for { select { case renderReq <- time.Now(): diff --git a/progress.go b/progress.go index cf6a14f..9a510b5 100644 --- a/progress.go +++ b/progress.go @@ -194,7 +194,7 @@ select { case p.operateState <- func(s *pState) { s.hm.iter(iter, drop) }: for b := range iter { - if cb(b) { + if !cb(b) { close(drop) break }