From 2a7c93ebf9efd734f0daf66ab89a78a1a2ab0c44 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 21 Jan 2025 15:43:29 +0800 Subject: [PATCH] eth/filters: ensure filter api timeout loop terminates with filter event system termination --- eth/filters/api.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eth/filters/api.go b/eth/filters/api.go index f46dd39dd8c0..e3057a2af26a 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -90,7 +90,11 @@ func (api *FilterAPI) timeoutLoop(timeout time.Duration) { ticker := time.NewTicker(timeout) defer ticker.Stop() for { - <-ticker.C + select { + case <-ticker.C: + case <-api.events.chainSub.Err(): + return + } api.filtersMu.Lock() for id, f := range api.filters { select {