Codebase list golang-github-vbauerster-mpb / 0a1ff47
run each OnShutdown from within b.serve Vladimir Bauer 1 year, 10 months ago
1 changed file(s) with 4 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
400400 case op := <-b.operateState:
401401 op(bs)
402402 case <-b.ctx.Done():
403 shutdownListeners := bs.shutdownListeners
403404 bs.aborted = !bs.completed()
404 bs.decoratorShutdownNotify(&b.container.bwg)
405405 b.bs = bs
406406 close(b.bsOk)
407 for _, d := range shutdownListeners {
408 d.OnShutdown()
409 }
407410 b.container.bwg.Done()
408411 return
409412 }
587590 }
588591 }
589592
590 func (s bState) decoratorShutdownNotify(wg *sync.WaitGroup) {
591 wg.Add(len(s.shutdownListeners))
592 for _, d := range s.shutdownListeners {
593 d := d
594 go func() {
595 d.OnShutdown()
596 wg.Done()
597 }()
598 }
599 }
600
601593 func (s bState) newStatistics(tw int) decor.Statistics {
602594 return decor.Statistics{
603595 AvailableWidth: tw,