Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113

Liang Ding07ad00ec958d
diff --git a/kernel/model/block.go b/kernel/model/block.go
index 0fb8d40d27..c74528b385 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 038907aa44..56875ee546 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()
}
}