mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 12:06:40 +00:00
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.
This commit is contained in:
parent
2bf4a8ff73
commit
6c10996bf5
1 changed files with 5 additions and 1 deletions
|
|
@ -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…
Reference in a new issue