core/bloombits/matcher : Call stop timer if return before timeout

This commit is contained in:
ucwong 2020-04-03 03:43:11 +00:00
parent f7b29ec942
commit 3ec95e7751

View file

@ -529,7 +529,8 @@ func (s *MatcherSession) Close() {
s.closer.Do(func() {
// Signal termination and wait for all goroutines to tear down
close(s.quit)
time.AfterFunc(time.Second, func() { close(s.kill) })
timeout := time.AfterFunc(time.Second, func() { close(s.kill) })
defer timeout.Stop()
s.pend.Wait()
})
}