Merge pull request #4725 from halseth/chaneventstore-race

chanfitness/chaneventstore:  stop ticker after goroutine
This commit is contained in:
András Bánki-Horváth 2020-10-28 11:26:30 +01:00 committed by GitHub
commit dc16869d72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -203,12 +203,13 @@ func (c *ChannelEventStore) Start() error {
func (c *ChannelEventStore) Stop() {
log.Info("Stopping event store")
c.cfg.FlapCountTicker.Stop()
// Stop the consume goroutine.
close(c.quit)
c.wg.Wait()
// Stop the ticker after the goroutine reading from it has exited, to
// avoid a race.
c.cfg.FlapCountTicker.Stop()
}
// addChannel checks whether we are already tracking a channel's peer, creates a