Skip to content

Commit

Permalink
test: fix pathdb unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
VM committed Sep 11, 2024
1 parent 8e44a30 commit 8e6c6df
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions triedb/pathdb/nodebufferlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,21 @@ func (nf *nodebufferlist) commit(root common.Hash, id uint64, block uint64, node
defer nf.mux.Unlock()

if nf.useBase.Load() {
for {
if nf.isFlushing.Swap(true) {
time.Sleep(time.Duration(DefaultBackgroundFlushInterval) * time.Second)
log.Info("waiting base node buffer to be flushed to disk")
continue
} else {
break
}
}
defer nf.isFlushing.Store(false)

nf.baseMux.Lock()
nf.flushMux.Lock()
// nf.flushMux.Lock()
defer nf.baseMux.Unlock()
defer nf.flushMux.Unlock()
// defer nf.flushMux.Unlock()
if err := nf.base.commit(root, id, block, 1, nodes); err != nil {
log.Crit("Failed to commit nodes to node buffer list", "error", err)
}
Expand Down

0 comments on commit 8e6c6df

Please sign in to comment.