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 34e816b
Show file tree
Hide file tree
Showing 2 changed files with 17 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
5 changes: 5 additions & 0 deletions vochain/indexer/migrations/0017_dummy.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- +goose Up
-- intentionally does nothing

-- This is a no-op command in SQLite, used just to have a valid SQL statement.
SELECT 1;

0 comments on commit 34e816b

Please sign in to comment.