Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Data synchronization supports the multi-kernel online perception https://github.com/siyuan-note/siyuan/issues/8518

Danielc697a2fc11c5
diff --git a/kernel/model/sync.go b/kernel/model/sync.go
index f42f4cd68f..3461a528d6 100644
--- a/kernel/model/sync.go
+++ b/kernel/model/sync.go
@@ -226,7 +226,7 @@ func syncData(exit, byHand, byWebSocket bool) {
connectSyncWebSocket()
}
- if 1 == Conf.Sync.Mode && !byWebSocket {
+ if 1 == Conf.Sync.Mode && !byWebSocket && nil != webSocketConn {
// 如果处于自动同步模式且不是又 WS 触发的同步,则通知其他设备上的内核进行同步
request := map[string]interface{}{
"cmd": "synced",
@@ -642,6 +642,10 @@ func connectSyncWebSocket() {
return
}
+ if util.ContainerDocker == util.Container {
+ return
+ }
+
webSocketConnLock.Lock()
defer webSocketConnLock.Unlock()
@@ -650,6 +654,7 @@ func connectSyncWebSocket() {
}
if "1602224134353" != Conf.User.UserId {
+ // TODO 测试账号
return
}
@@ -719,22 +724,6 @@ func connectSyncWebSocket() {
}
}
}()
-
- go func() {
- defer logging.Recover()
-
- for {
- time.Sleep(10 * time.Second)
- //request := map[string]interface{}{
- // "cmd": "ping",
- //}
- //
- //if writeErr := c.WriteJSON(request); nil != writeErr {
- // logging.LogErrorf("write sync websocket message failed: %s", writeErr)
- // return
- //}
- }
- }()
}
var kernelID = gulu.Rand.String(7)