Skip to content

Commit

Permalink
eth/filters: ensure API timeoutLoop terminates with event system (#31…
Browse files Browse the repository at this point in the history
…056)

Discovered from failing test introduced
ethereum/go-ethereum#31033 . We should ensure
`timeoutLoop` terminates if the filter event system is terminated.
  • Loading branch information
jwasinger authored and sebastianst committed Jan 23, 2025
1 parent 363b06d commit cff02d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion eth/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cff02d5

Please sign in to comment.