eth/filters: ensure API timeoutLoop terminates with event system (#31056)

Discovered from failing test introduced
https://github.com/ethereum/go-ethereum/pull/31033 . We should ensure
`timeoutLoop` terminates if the filter event system is terminated.
pull/31057/head
jwasinger 1 week ago committed by GitHub
parent 2bf4a8ff73
commit 6c10996bf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      eth/filters/api.go

@ -90,7 +90,11 @@ func (api *FilterAPI) timeoutLoop(timeout time.Duration) {
ticker := time.NewTicker(timeout) ticker := time.NewTicker(timeout)
defer ticker.Stop() defer ticker.Stop()
for { for {
<-ticker.C select {
case <-ticker.C:
case <-api.events.chainSub.Err():
return
}
api.filtersMu.Lock() api.filtersMu.Lock()
for id, f := range api.filters { for id, f := range api.filters {
select { select {

Loading…
Cancel
Save