mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🐛 桌面端内核在授权页自动退出 https://github.com/siyuan-note/insider/issues/1099
This commit is contained in:
parent
cca4eeb207
commit
2be5545dbf
3 changed files with 25 additions and 10 deletions
|
|
@ -32,16 +32,26 @@ func HookResident() {
|
|||
}
|
||||
|
||||
for range time.Tick(time.Second * 30) {
|
||||
if 0 == util.CountSessions() {
|
||||
time.Sleep(time.Second * 7)
|
||||
if 0 == util.CountSessions() {
|
||||
logging.LogInfof("no active session, exit kernel process now")
|
||||
Close(false, 1)
|
||||
}
|
||||
if makeSureSessionEmpty() {
|
||||
logging.LogInfof("no active session, exit kernel process now")
|
||||
Close(false, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func makeSureSessionEmpty() bool {
|
||||
count := 0
|
||||
for i := 0; i < 7; i++ {
|
||||
count = util.CountSessions()
|
||||
//logging.LogDebugf("session count [%d]", count)
|
||||
if 0 < count {
|
||||
return false
|
||||
}
|
||||
time.Sleep(time.Second * 1)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func HandleSignal() {
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue