Codebase list golang-github-vbauerster-mpb / 2dcb25d
refactoring tryEarlyRefresh Vladimir Bauer 2 years ago
2 changed file(s) with 8 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
459459 }
460460
461461 func (b *Bar) tryEarlyRefresh(renderReq chan<- time.Time) {
462 var anyOtherRunning bool
462 var otherRunning int
463463 b.container.traverseBars(func(bar *Bar) bool {
464 anyOtherRunning = b != bar && bar.IsRunning()
465 return anyOtherRunning
464 if b != bar && bar.IsRunning() {
465 otherRunning++
466 return false // stop traverse
467 }
468 return true // continue traverse
466469 })
467 if !anyOtherRunning {
470 if otherRunning == 0 {
468471 for {
469472 select {
470473 case renderReq <- time.Now():
193193 select {
194194 case p.operateState <- func(s *pState) { s.hm.iter(iter, drop) }:
195195 for b := range iter {
196 if cb(b) {
196 if !cb(b) {
197197 close(drop)
198198 break
199199 }