From 80632aa17d63a5970bc1f78e572c0fd157cba0a2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 28 Mar 2025 12:34:44 +0100 Subject: [PATCH] core/filtermaps: fix hang in tests Since the index can now be disabled at runtime, it is no longer safe to just check the disabled field once. --- core/filtermaps/indexer.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 } }