Skip to content

Commit

Permalink
ensure API timeoutLoop terminates with event system
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Jan 22, 2025
1 parent 27b8750 commit 19f5116
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ctxc/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,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 19f5116

Please sign in to comment.