File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -460,12 +460,15 @@ func (b *Bar) triggerCompletion(s *bState) {
460
460
}
461
461
462
462
func (b * Bar ) tryEarlyRefresh (renderReq chan <- time.Time ) {
463
- var anyOtherRunning bool
463
+ var otherRunning int
464
464
b .container .traverseBars (func (bar * Bar ) bool {
465
- anyOtherRunning = b != bar && bar .IsRunning ()
466
- return anyOtherRunning
465
+ if b != bar && bar .IsRunning () {
466
+ otherRunning ++
467
+ return false // stop traverse
468
+ }
469
+ return true // continue traverse
467
470
})
468
- if ! anyOtherRunning {
471
+ if otherRunning == 0 {
469
472
for {
470
473
select {
471
474
case renderReq <- time .Now ():
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ func (p *Progress) traverseBars(cb func(b *Bar) bool) {
194
194
select {
195
195
case p .operateState <- func (s * pState ) { s .hm .iter (iter , drop ) }:
196
196
for b := range iter {
197
- if cb (b ) {
197
+ if ! cb (b ) {
198
198
close (drop )
199
199
break
200
200
}
You can’t perform that action at this time.
0 commit comments