remove example: don't drop aborted bar
Vladimir Bauer
4 years ago
| 25 | 25 | decor.Name(name), |
| 26 | 26 | decor.EwmaETA(decor.ET_STYLE_GO, 60, decor.WCSyncSpace), |
| 27 | 27 | ), |
| 28 | mpb.AppendDecorators(decor.Percentage()), | |
| 28 | mpb.AppendDecorators(decor.Percentage(decor.WCSyncSpace)), | |
| 29 | 29 | ) |
| 30 | 30 | go func() { |
| 31 | 31 | defer wg.Done() |
| 36 | 36 | // EWMA's unit of measure is an iteration's duration |
| 37 | 37 | start := time.Now() |
| 38 | 38 | if bar.ID() == 2 && i >= 42 { |
| 39 | // aborting and removing while bar is running | |
| 40 | bar.Abort(true) | |
| 39 | bar.Abort(false) | |
| 41 | 40 | } |
| 42 | 41 | time.Sleep(time.Duration(rng.Intn(10)+1) * max / 10) |
| 43 | 42 | bar.Increment() |