Skip to content

Commit

Permalink
fix leaking goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Mar 2, 2019
1 parent 17515e1 commit b165cdd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/announcer/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ func (a *StopAnnouncer) Run() {

ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(a.timeout))
go func() {
<-a.closeC
cancel()
select {
case <-ctx.Done():
case <-a.closeC:
cancel()
}
}()

doneC := make(chan struct{})
Expand Down

0 comments on commit b165cdd

Please sign in to comment.