diff --git a/bar.go b/bar.go index 5f814121..e50a8e7c 100644 --- a/bar.go +++ b/bar.go @@ -460,12 +460,15 @@ func (b *Bar) triggerCompletion(s *bState) { } 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 cf6a14f3..9a510b5f 100644 --- a/progress.go +++ b/progress.go @@ -194,7 +194,7 @@ func (p *Progress) traverseBars(cb func(b *Bar) bool) { 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 }