From 3ec95e7751aaeb1abe4f897696d634c0fcc3421a Mon Sep 17 00:00:00 2001 From: ucwong Date: Fri, 3 Apr 2020 03:43:11 +0000 Subject: [PATCH] core/bloombits/matcher : Call stop timer if return before timeout --- core/bloombits/matcher.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/bloombits/matcher.go b/core/bloombits/matcher.go index 3ec0d5ae94..a82c9c9203 100644 --- a/core/bloombits/matcher.go +++ b/core/bloombits/matcher.go @@ -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() }) }