An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
Liang Ding2d94fd2b7605
diff --git a/kernel/main.go b/kernel/main.goindex 426622bd8b..caf2dd1c70 100644--- a/kernel/main.go+++ b/kernel/main.go@@ -52,7 +52,7 @@ func main() {util.PushClearAllMsg()go model.AutoRefreshCheck()go model.AutoFlushTx()- go sql.AutoFlushQueue()+ go sql.AutoFlushTx()go treenode.AutoFlushBlockTree()go cache.LoadAssets()go model.AutoFixIndex()diff --git a/kernel/mobile/kernel.go b/kernel/mobile/kernel.goindex 67b339a1d1..c043809dc5 100644--- a/kernel/mobile/kernel.go+++ b/kernel/mobile/kernel.go@@ -66,7 +66,7 @@ func StartKernel(container, appDir, workspaceBaseDir, timezoneID, localIPs, langutil.PushClearAllMsg()go model.AutoRefreshCheck()go model.AutoFlushTx()- go sql.AutoFlushQueue()+ go sql.AutoFlushTx()go treenode.AutoFlushBlockTree()go cache.LoadAssets()go model.AutoFixIndex()diff --git a/kernel/model/ocr.go b/kernel/model/ocr.goindex 19cc77dae9..740145e4d4 100644--- a/kernel/model/ocr.go+++ b/kernel/model/ocr.go@@ -1,7 +1,6 @@package modelimport (- "github.com/dustin/go-humanize""io""os""path/filepath"@@ -12,9 +11,11 @@ import ("time""github.com/88250/gulu"+ "github.com/dustin/go-humanize""github.com/panjf2000/ants/v2""github.com/siyuan-note/logging""github.com/siyuan-note/siyuan/kernel/cache"+ "github.com/siyuan-note/siyuan/kernel/task""github.com/siyuan-note/siyuan/kernel/util")@@ -24,7 +25,7 @@ func AutoOCRAssets() {}for {- autoOCRAssets()+ task.AppendTask(task.OCRImage, autoOCRAssets)time.Sleep(7 * time.Second)}}diff --git a/kernel/sql/queue.go b/kernel/sql/queue.goindex c9c71cfa2a..2b076f97ca 100644--- a/kernel/sql/queue.go+++ b/kernel/sql/queue.go@@ -29,6 +29,7 @@ import ("github.com/emirpasic/gods/sets/hashset""github.com/siyuan-note/eventbus""github.com/siyuan-note/logging"+ "github.com/siyuan-note/siyuan/kernel/task""github.com/siyuan-note/siyuan/kernel/util")@@ -50,10 +51,10 @@ type treeQueueOperation struct {renameTreeOldHPath string // rename}-func AutoFlushTreeQueue() {+func AutoFlushTx() {for {- flushTreeQueue()time.Sleep(util.SQLFlushInterval)+ task.PrependTask(task.DatabaseIndex, FlushQueue)}}@@ -91,7 +92,7 @@ func ClearQueue() {operationQueue = nil}-func flushTreeQueue() {+func FlushQueue() {ops := mergeUpsertTrees()if 1 > len(ops) {return