Skip to content

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

:art: Improve wal queue

Daniel038dc6e1836b
diff --git a/kernel/sql/queue_wal.go b/kernel/sql/queue_wal.go
index a790733f7c..cbf15fe73a 100644
--- a/kernel/sql/queue_wal.go
+++ b/kernel/sql/queue_wal.go
@@ -24,6 +24,7 @@ import (
"sync"
"sync/atomic"
+ "github.com/88250/gulu"
"github.com/88250/lute"
"github.com/88250/lute/parse"
"github.com/siyuan-note/dataparser"
@@ -183,8 +184,10 @@ func clearWALEntries() {
defer walMu.Unlock()
walPath := filepath.Join(util.TempDir, "queue.wal")
- if err := os.Truncate(walPath, 0); err != nil {
- logging.LogErrorf("clear WAL failed: %s", err)
+ if gulu.File.IsExist(walPath) {
+ if err := os.Truncate(walPath, 0); err != nil {
+ logging.LogErrorf("clear WAL failed: %s", err)
+ }
}
walSize.Store(0)
}