Skip to content

Commit

Permalink
(lts-backport) don't WaitUntilSync, just until BlockStore
Browse files Browse the repository at this point in the history
  • Loading branch information
altergui committed Sep 9, 2024
1 parent 71b1fa4 commit 9336be3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion vochain/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,18 @@ func (idx *Indexer) AfterSyncBootstrap(inTest bool) {
// ReindexBlocks reindexes all blocks found in blockstore
func (idx *Indexer) ReindexBlocks(inTest bool) {
if !inTest {
<-idx.App.WaitUntilSynced()
done := make(chan any)
go func() {
for idx.App == nil ||
idx.App.Node == nil ||
idx.App.Node.BlockStore() == nil {
log.Info("waiting for reindexing")
time.Sleep(time.Second * 1)
}
close(done)
}()

<-done
}

// Note that holding blockMu means new votes aren't added until the reindex finishes.
Expand Down

0 comments on commit 9336be3

Please sign in to comment.