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 data sync perception when data merging https://github.com/siyuan-note/siyuan/issues/9740
Daniel2f2abf0eff2e
diff --git a/kernel/go.mod b/kernel/go.modindex b146a7bd0b..34f6936ef6 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.8github.com/shirou/gopsutil/v3 v3.23.10- github.com/siyuan-note/dejavu v0.0.0-20231124091823-9b5765d14aeb+ github.com/siyuan-note/dejavu v0.0.0-20231125082301-edddcb1de16fgithub.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-20231107122348-6ed75b0b525adiff --git a/kernel/go.sum b/kernel/go.sumindex b1c29a528e..6e06fe223c 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -358,6 +358,8 @@ github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05Utgithub.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=github.com/siyuan-note/dejavu v0.0.0-20231124091823-9b5765d14aeb h1:MJ7XvdmgaMqyYw0y0uHyRQTjhXIvRq8Q9bDnhLK4GEE=github.com/siyuan-note/dejavu v0.0.0-20231124091823-9b5765d14aeb/go.mod h1:qt8rUiTbSfM9+kilENizIB4pwido3BJd571GQkTv4XU=+github.com/siyuan-note/dejavu v0.0.0-20231125082301-edddcb1de16f h1:RG6ap1PnZIPXVUFmCw/bxLiX6o/VGZwRjmSxBPQDXfE=+github.com/siyuan-note/dejavu v0.0.0-20231125082301-edddcb1de16f/go.mod h1:qt8rUiTbSfM9+kilENizIB4pwido3BJd571GQkTv4XU=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/conf.go b/kernel/model/conf.goindex fb61af3451..cbd9f24948 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -501,7 +501,7 @@ func Close(force bool, execInstallPkg int) (exitCode int) {if !force {if Conf.Sync.Enabled && 3 != Conf.Sync.Mode &&((IsSubscriber() && conf.ProviderSiYuan == Conf.Sync.Provider) || conf.ProviderSiYuan != Conf.Sync.Provider) {- syncData(true, false, false)+ syncData(true, false)if 0 != ExitSyncSucc {exitCode = 1returndiff --git a/kernel/model/repository.go b/kernel/model/repository.goindex bc14ef8a7a..03a34579cf 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -1237,7 +1237,7 @@ func syncRepo(exit, byHand bool) (dataChanged bool, err error) {return}- dataChanged = nil == beforeIndex || beforeIndex.ID != afterIndex.ID+ dataChanged = nil == beforeIndex || beforeIndex.ID != afterIndex.ID || mergeResult.DataChanged()util.PushStatusBar(fmt.Sprintf(Conf.Language(149), elapsed.Seconds()))Conf.Sync.Synced = util.CurrentTimeMillis()diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex bf8f7ce2d6..f00e94d7b0 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -152,10 +152,10 @@ func BootSyncData() {}func SyncData(byHand bool) {- syncData(false, byHand, false)+ syncData(false, byHand)}-func syncData(exit, byHand, byWebSocket bool) {+func syncData(exit, byHand bool) {defer logging.Recover()if !checkSync(false, exit, byHand) {@@ -192,7 +192,7 @@ func syncData(exit, byHand, byWebSocket bool) {connectSyncWebSocket()}- if 1 == Conf.Sync.Mode && !byWebSocket && nil != webSocketConn && Conf.Sync.Perception && dataChanged {+ if 1 == Conf.Sync.Mode && nil != webSocketConn && Conf.Sync.Perception && dataChanged {// 如果处于自动同步模式且不是又 WS 触发的同步,则通知其他设备上的内核进行同步request := map[string]interface{}{"cmd": "synced",@@ -746,7 +746,7 @@ func connectSyncWebSocket() {data := result.Data.(map[string]interface{})switch data["cmd"].(string) {case "synced":- syncData(false, false, true)+ syncData(false, false)case "kernels":onlineKernelsLock.Lock()