From 07ad00ec958da27554b6ee63be12b482799c7124 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 25 Jan 2023 20:32:25 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=B9=E8=BF=9B=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=B0=83=E5=BA=A6=E6=9C=BA=E5=88=B6=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E7=A8=B3=E5=AE=9A=E6=80=A7=20https://github.com/siyua?= =?UTF-8?q?n-note/siyuan/issues/7113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/block.go | 8 +++++--- kernel/sql/queue.go | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/model/block.go b/kernel/model/block.go index 0fb8d40d2..c74528b38 100644 --- a/kernel/model/block.go +++ b/kernel/model/block.go @@ -391,11 +391,13 @@ func getBlock(id string) (ret *Block, err error) { return } - waitForIndexing() - tree, err := loadTreeByBlockID(id) if nil != err { - return + waitForIndexing() + tree, err = loadTreeByBlockID(id) + if nil != err { + return + } } node := treenode.GetNodeInTree(tree, id) diff --git a/kernel/sql/queue.go b/kernel/sql/queue.go index 038907aa4..56875ee54 100644 --- a/kernel/sql/queue.go +++ b/kernel/sql/queue.go @@ -21,6 +21,7 @@ import ( "errors" "fmt" "path" + "runtime/debug" "sync" "time" @@ -121,7 +122,7 @@ func FlushQueue() { return } - if 0 < i && 0 == execOps%64 { + if 0 < i && 0 == execOps%128 { if err = commitTx(tx); nil != err { logging.LogErrorf("commit tx failed: %s", err) return @@ -132,6 +133,7 @@ func FlushQueue() { if nil != err { return } + debug.FreeOSMemory() } }