Skip to content

Commit 226a094

Browse files
jwasingerjakub-freebit
authored andcommitted
eth/filters: ensure API timeoutLoop terminates with event system (ethereum#31056)
Discovered from failing test introduced ethereum#31033 . We should ensure `timeoutLoop` terminates if the filter event system is terminated.
1 parent 5dd2ce0 commit 226a094

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

eth/filters/api.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ func (api *FilterAPI) timeoutLoop(timeout time.Duration) {
9090
ticker := time.NewTicker(timeout)
9191
defer ticker.Stop()
9292
for {
93-
<-ticker.C
93+
select {
94+
case <-ticker.C:
95+
case <-api.events.chainSub.Err():
96+
return
97+
}
9498
api.filtersMu.Lock()
9599
for id, f := range api.filters {
96100
select {

0 commit comments

Comments
 (0)