Skip to content

Commit

Permalink
run shutdownListeners concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Aug 17, 2024
1 parent ff80242 commit c31e10e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bar.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,17 @@ func (b *Bar) serve(bs *bState) {
case op := <-b.operateState:
op(bs)
case <-b.ctx.Done():
shutdownListeners := bs.shutdownListeners
for _, d := range bs.shutdownListeners {
b.container.bwg.Add(1)
d := d
go func() {
d.OnShutdown()
b.container.bwg.Done()
}()
}
bs.aborted = !bs.completed()
b.bs = bs
close(b.bsOk)
for _, d := range shutdownListeners {
d.OnShutdown()
}
b.container.bwg.Done()
return
}
Expand Down

0 comments on commit c31e10e

Please sign in to comment.