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: Improve kernel stability by eliminating some data races https://github.com/siyuan-note/siyuan/issues/9842
Danieldbd52231e975
diff --git a/kernel/go.mod b/kernel/go.modindex a66b5d8d61..ff098f38ff 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -50,7 +50,7 @@ require (github.com/rqlite/sql v0.0.0-20221103124402-8f9ff0ceb8f0github.com/sashabaranov/go-openai v1.17.9github.com/shirou/gopsutil/v3 v3.23.11- github.com/siyuan-note/dejavu v0.0.0-20231208043525-6211184a4438+ github.com/siyuan-note/dejavu v0.0.0-20231208085113-c89895f2a075github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80github.com/siyuan-note/filelock v0.0.0-20231206081043-b75b363ddb1bdiff --git a/kernel/go.sum b/kernel/go.sumindex fbb4d6b0a5..36b3a314ff 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -356,8 +356,8 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRgithub.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=-github.com/siyuan-note/dejavu v0.0.0-20231208043525-6211184a4438 h1:MMQYT1Kbrr2kgmwSwJXseCM+CUg5QmWMgFz3xseQIBk=-github.com/siyuan-note/dejavu v0.0.0-20231208043525-6211184a4438/go.mod h1:JFtbncCYIJft4Krp7U8wdxfqmV7DzpVpfBwz/KGUjX4=+github.com/siyuan-note/dejavu v0.0.0-20231208085113-c89895f2a075 h1:AS4npSJSgBXGMR09USiPgdXmeaIJ02p5xFmPZjMNSTs=+github.com/siyuan-note/dejavu v0.0.0-20231208085113-c89895f2a075/go.mod h1:JFtbncCYIJft4Krp7U8wdxfqmV7DzpVpfBwz/KGUjX4=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 h1:XghjHKJd+SiL0DkGYFVC+UGUDFtnR4v9gkAbPeh9Eq8=diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex 0b2601d3fb..5598218973 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -163,11 +163,11 @@ func SyncData(byHand bool) {func lockSync() {syncLock.Lock()- isSyncing = true+ isSyncing.Store(true)}func unlockSync() {- isSyncing = false+ isSyncing.Store(false)syncLock.Unlock()}@@ -178,15 +178,15 @@ func syncData(exit, byHand bool) {return}+ lockSync()+ defer unlockSync()+util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)if !exit && !isProviderOnline(byHand) { // 这个操作比较耗时,所以要先推送 syncing 事件后再判断网络,这样才能给用户更即时的反馈util.BroadcastByType("main", "syncing", 2, Conf.Language(28), nil)return}- lockSync()- defer unlockSync()-if exit {ExitSyncSucc = 0logging.LogInfof("sync before exit")@@ -256,7 +256,7 @@ func checkSync(boot, exit, byHand bool) bool {}}- if isSyncing {+ if isSyncing.Load() {logging.LogWarnf("sync is in progress")planSyncAfter(fixSyncInterval)return false@@ -431,7 +431,7 @@ func SetSyncProviderWebDAV(webdav *conf.WebDAV) (err error) {var (syncLock = sync.Mutex{}- isSyncing bool+ isSyncing = atomic.Bool{})func CreateCloudSyncDir(name string) (err error) {