mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Data synchronization supports the multi-kernel online perception https://github.com/siyuan-note/siyuan/issues/8518
This commit is contained in:
parent
3579a45831
commit
49499e13b6
2 changed files with 17 additions and 1 deletions
|
|
@ -509,7 +509,7 @@ func Close(force bool, execInstallPkg int) (exitCode int) {
|
||||||
time.Sleep(4 * time.Second)
|
time.Sleep(4 * time.Second)
|
||||||
}
|
}
|
||||||
logging.LogInfof("exited kernel")
|
logging.LogInfof("exited kernel")
|
||||||
webSocketConn.Close()
|
closeSyncWebSocket()
|
||||||
util.WebSocketServer.Close()
|
util.WebSocketServer.Close()
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(500 * time.Millisecond)
|
time.Sleep(500 * time.Millisecond)
|
||||||
|
|
|
||||||
|
|
@ -372,6 +372,12 @@ func SetSyncEnable(b bool) {
|
||||||
func SetSyncPerception(b bool) {
|
func SetSyncPerception(b bool) {
|
||||||
Conf.Sync.Perception = b
|
Conf.Sync.Perception = b
|
||||||
Conf.Save()
|
Conf.Save()
|
||||||
|
|
||||||
|
if b {
|
||||||
|
connectSyncWebSocket()
|
||||||
|
} else {
|
||||||
|
closeSyncWebSocket()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -641,6 +647,16 @@ var (
|
||||||
onlineKernelsLock = sync.Mutex{}
|
onlineKernelsLock = sync.Mutex{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func closeSyncWebSocket() {
|
||||||
|
webSocketConnLock.Lock()
|
||||||
|
defer webSocketConnLock.Unlock()
|
||||||
|
|
||||||
|
if nil != webSocketConn {
|
||||||
|
webSocketConn.Close()
|
||||||
|
webSocketConn = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func connectSyncWebSocket() {
|
func connectSyncWebSocket() {
|
||||||
defer logging.Recover()
|
defer logging.Recover()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue