mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
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.
This commit is contained in:
parent
f532e4439a
commit
80632aa17d
1 changed files with 7 additions and 6 deletions
|
|
@ -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
|
// WaitIdle blocks until the indexer is in an idle state while synced up to the
|
||||||
// latest targetView.
|
// latest targetView.
|
||||||
func (f *FilterMaps) WaitIdle() {
|
func (f *FilterMaps) WaitIdle() {
|
||||||
if f.disabled {
|
|
||||||
f.closeWg.Wait()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for {
|
for {
|
||||||
ch := make(chan bool)
|
ch := make(chan bool)
|
||||||
f.waitIdleCh <- ch
|
select {
|
||||||
if <-ch {
|
case f.waitIdleCh <- ch:
|
||||||
|
if <-ch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case <-f.disabledCh:
|
||||||
|
f.closeWg.Wait()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue