mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-20 15:26:09 +01:00
🎨 Data sync supports the multi-kernel online perception https://github.com/siyuan-note/siyuan/issues/8518
This commit is contained in:
parent
18985de1e5
commit
5e041d9017
4 changed files with 8 additions and 8 deletions
|
|
@ -1092,7 +1092,7 @@ func bootSyncRepo() (err error) {
|
|||
|
||||
if 0 < len(fetchedFiles) {
|
||||
go func() {
|
||||
syncErr := syncRepo(false, false)
|
||||
_, syncErr := syncRepo(false, false)
|
||||
if nil != err {
|
||||
logging.LogErrorf("boot background sync repo failed: %s", syncErr)
|
||||
return
|
||||
|
|
@ -1102,7 +1102,7 @@ func bootSyncRepo() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func syncRepo(exit, byHand bool) (err error) {
|
||||
func syncRepo(exit, byHand bool) (mergeResult *dejavu.MergeResult, err error) {
|
||||
if 1 > len(Conf.Repo.Key) {
|
||||
autoSyncErrCount++
|
||||
planSyncAfter(fixSyncInterval)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ func syncData(exit, byHand, byWebSocket bool) {
|
|||
now := util.CurrentTimeMillis()
|
||||
Conf.Sync.Synced = now
|
||||
|
||||
err := syncRepo(exit, byHand)
|
||||
mergeResult, err := syncRepo(exit, byHand)
|
||||
code := 1
|
||||
if nil != err {
|
||||
code = 2
|
||||
|
|
@ -192,7 +192,7 @@ func syncData(exit, byHand, byWebSocket bool) {
|
|||
connectSyncWebSocket()
|
||||
}
|
||||
|
||||
if 1 == Conf.Sync.Mode && !byWebSocket && nil != webSocketConn && Conf.Sync.Perception {
|
||||
if 1 == Conf.Sync.Mode && !byWebSocket && nil != webSocketConn && Conf.Sync.Perception && mergeResult.DataChanged() {
|
||||
// 如果处于自动同步模式且不是又 WS 触发的同步,则通知其他设备上的内核进行同步
|
||||
request := map[string]interface{}{
|
||||
"cmd": "synced",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue