mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 23:38:49 +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
|
|
@ -31,6 +31,7 @@ require (
|
|||
github.com/go-ole/go-ole v1.2.6
|
||||
github.com/goccy/go-json v0.10.2
|
||||
github.com/gofrs/flock v0.8.1
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
github.com/imroc/req/v3 v3.35.2
|
||||
github.com/jinzhu/copier v0.3.5
|
||||
github.com/json-iterator/go v1.1.12
|
||||
|
|
@ -44,7 +45,7 @@ require (
|
|||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/sashabaranov/go-openai v1.9.5
|
||||
github.com/shirou/gopsutil/v3 v3.23.5
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230610031820-8b10ca0d32b9
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230612120039-bba808ca7649
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
|
||||
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b
|
||||
github.com/siyuan-note/filelock v0.0.0-20230523004741-d9121740f638
|
||||
|
|
@ -89,7 +90,6 @@ require (
|
|||
github.com/gorilla/css v1.0.0 // indirect
|
||||
github.com/gorilla/securecookie v1.1.1 // indirect
|
||||
github.com/gorilla/sessions v1.2.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hhrutter/lzw v1.0.0 // indirect
|
||||
|
|
|
|||
|
|
@ -281,8 +281,8 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g
|
|||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.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/siyuan-note/dejavu v0.0.0-20230610031820-8b10ca0d32b9 h1:zG/c1Bhx4/rUxcPtr3O23WhbapN5R2ny8j1AuLdrV6k=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230610031820-8b10ca0d32b9/go.mod h1:hqZGaLRW8MNQiypk+RsRWMjjCHx4i+RSoZiK62q9m0Q=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230612120039-bba808ca7649 h1:MpzA21Jp0ofPJJxP8DwQGVXU2BGGV/blBFk130Du1Mw=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230612120039-bba808ca7649/go.mod h1:hqZGaLRW8MNQiypk+RsRWMjjCHx4i+RSoZiK62q9m0Q=
|
||||
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-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg=
|
||||
|
|
|
|||
|
|
@ -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