From f9643c4e38c6911714bdae55a3f1bb937100c2be Mon Sep 17 00:00:00 2001 From: will-2012 <117156346+will-2012@users.noreply.github.com> Date: Fri, 24 May 2024 09:10:33 +0800 Subject: [PATCH] fix: adjust flush condition to avoid not flush (#114) Co-authored-by: will@2012 --- trie/triedb/pathdb/nodebufferlist.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trie/triedb/pathdb/nodebufferlist.go b/trie/triedb/pathdb/nodebufferlist.go index f0954e826d..44958d6fda 100644 --- a/trie/triedb/pathdb/nodebufferlist.go +++ b/trie/triedb/pathdb/nodebufferlist.go @@ -128,11 +128,12 @@ func newNodeBufferList( waitForceKeepCh: make(chan struct{}), keepFunc: keepFunc, } + go nf.loop() log.Info("new node buffer list", "proposed block interval", nf.wpBlocks, "reserve multi difflayers", nf.rsevMdNum, "difflayers in multidifflayer", nf.dlInMd, - "limit", common.StorageSize(limit), "layers", layers, "persist id", nf.persistID) + "limit", common.StorageSize(limit), "layers", layers, "persist id", nf.persistID, "base_size", size) return nf } @@ -590,7 +591,7 @@ func (nf *nodebufferlist) loop() { continue } nf.diffToBase() - if nf.base.size > nf.base.limit { + if nf.base.size >= nf.base.limit { nf.backgroundFlush() } nf.isFlushing.Swap(false)