🎨 Improve data sync perception when data merging https://github.com/siyuan-note/siyuan/issues/9740

This commit is contained in:
Daniel 2023-11-25 17:13:43 +08:00
parent 4cd93b0fec
commit 2f2abf0eff
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 9 additions and 7 deletions

View file

@ -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 = 1
return

View file

@ -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()

View file

@ -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()