mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
🎨 Improve boot index checking https://github.com/siyuan-note/siyuan/issues/11842
This commit is contained in:
parent
c9d3a50fd4
commit
ed5c4738f9
5 changed files with 38 additions and 22 deletions
|
|
@ -81,7 +81,7 @@ type AppConf struct {
|
|||
ShowChangelog bool `json:"showChangelog"` // 是否显示版本更新日志
|
||||
CloudRegion int `json:"cloudRegion"` // 云端区域,0:中国大陆,1:北美
|
||||
Snippet *conf.Snpt `json:"snippet"` // 代码片段
|
||||
State int `json:"state"` // 运行状态,0:已经正常退出,1:运行中
|
||||
DataIndexState int `json:"dataIndexState"` // 数据索引状态,0:已索引,1:未索引
|
||||
|
||||
m *sync.Mutex
|
||||
}
|
||||
|
|
@ -464,8 +464,8 @@ func InitConf() {
|
|||
|
||||
Conf.LocalIPs = util.GetLocalIPs()
|
||||
|
||||
if 1 == Conf.State {
|
||||
// 上次未正常退出
|
||||
if 1 == Conf.DataIndexState {
|
||||
// 上次未正常完成数据索引
|
||||
go func() {
|
||||
util.WaitForUILoaded()
|
||||
time.Sleep(2 * time.Second)
|
||||
|
|
@ -477,7 +477,7 @@ func InitConf() {
|
|||
}()
|
||||
}
|
||||
|
||||
Conf.State = 1 // 运行中
|
||||
Conf.DataIndexState = 0
|
||||
|
||||
Conf.Save()
|
||||
logging.SetLogLevel(Conf.LogLevel)
|
||||
|
|
@ -716,7 +716,6 @@ func (conf *AppConf) save0(data []byte) {
|
|||
}
|
||||
|
||||
func (conf *AppConf) Close() {
|
||||
conf.State = 0 // 已经正常退出
|
||||
conf.Save()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -429,4 +429,14 @@ func subscribeSQLEvents() {
|
|||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
})
|
||||
|
||||
eventbus.Subscribe(eventbus.EvtSQLIndexChanged, func() {
|
||||
Conf.DataIndexState = 1
|
||||
Conf.Save()
|
||||
})
|
||||
|
||||
eventbus.Subscribe(eventbus.EvtSQLIndexFlushed, func() {
|
||||
Conf.DataIndexState = 0
|
||||
Conf.Save()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue