diff --git a/core/filtermaps/indexer.go b/core/filtermaps/indexer.go index a142c16cf8..823e476931 100644 --- a/core/filtermaps/indexer.go +++ b/core/filtermaps/indexer.go @@ -137,14 +137,15 @@ func (f *FilterMaps) SetBlockProcessing(blockProcessing bool) { // WaitIdle blocks until the indexer is in an idle state while synced up to the // latest targetView. func (f *FilterMaps) WaitIdle() { - if f.disabled { - f.closeWg.Wait() - return - } for { ch := make(chan bool) - f.waitIdleCh <- ch - if <-ch { + select { + case f.waitIdleCh <- ch: + if <-ch { + return + } + case <-f.disabledCh: + f.closeWg.Wait() return } }