Skip to content

Commit

Permalink
Fix issue causing graceful shutdown to be ignored during repeated pus…
Browse files Browse the repository at this point in the history
…h updates
  • Loading branch information
jnackman committed Feb 27, 2016
1 parent 6857773 commit f53a2b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions searcher/searcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func (s *Searcher) Update() bool {
func (s *Searcher) Stop() {
select {
case s.shutdownCh <- empty{}:
s.shutdownRequested = true
default:
}
}
Expand All @@ -171,12 +172,11 @@ func (s *Searcher) waitForUpdate(delay time.Duration) {
tch = time.After(delay)
}

// wait for either the timeout or the update channel signal
// wait for a timeout, the update channel signal, or a shutdown request
select {
case <-s.updateCh:
case <-tch:
case <-s.shutdownCh:
s.shutdownRequested = true
}
}

Expand Down

0 comments on commit f53a2b2

Please sign in to comment.