mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-28 18:00:15 +01:00
🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
This commit is contained in:
parent
c1ff45f4a4
commit
7d1b50116b
14 changed files with 51 additions and 52 deletions
|
|
@ -497,6 +497,10 @@ func genTreeID(tree *parse.Tree) {
|
|||
return
|
||||
}
|
||||
|
||||
func ReloadUI() {
|
||||
task.AppendTask(task.ReloadUI, util.ReloadUI)
|
||||
}
|
||||
|
||||
func FullReindex() {
|
||||
task.PrependTask(task.DatabaseIndexFull, fullReindex)
|
||||
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
|
||||
|
|
@ -518,12 +522,6 @@ func fullReindex() {
|
|||
}
|
||||
treenode.SaveBlockTree(true)
|
||||
LoadFlashcards()
|
||||
|
||||
util.PushMsg(Conf.Language(58), 7000)
|
||||
go func() {
|
||||
time.Sleep(1 * time.Second)
|
||||
util.ReloadUI()
|
||||
}()
|
||||
}
|
||||
|
||||
func ChangeBoxSort(boxIDs []string) {
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
|
||||
FullReindex()
|
||||
IncSync()
|
||||
ReloadUI()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -298,6 +299,7 @@ func RollbackNotebookHistory(historyPath string) (err error) {
|
|||
|
||||
FullReindex()
|
||||
IncSync()
|
||||
ReloadUI()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -441,6 +441,7 @@ func ImportData(zipPath string) (err error) {
|
|||
|
||||
IncSync()
|
||||
FullReindex()
|
||||
ReloadUI()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -706,13 +707,6 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
|||
return
|
||||
}
|
||||
IncSync()
|
||||
sql.WaitForWritingDatabase()
|
||||
|
||||
util.PushEndlessProgress(Conf.Language(58))
|
||||
go func() {
|
||||
time.Sleep(2 * time.Second)
|
||||
util.ReloadUI()
|
||||
}()
|
||||
}
|
||||
debug.FreeOSMemory()
|
||||
IncSync()
|
||||
|
|
|
|||
|
|
@ -197,16 +197,14 @@ func init() {
|
|||
// util.SetBootDetails(msg)
|
||||
// util.ContextPushMsg(context, msg)
|
||||
//})
|
||||
eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, current, total, blockCount int, hash string) {
|
||||
eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, blockCount int, hash string) {
|
||||
if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
|
||||
// Android/iOS 端不显示数据索引和搜索索引状态提示 https://github.com/siyuan-note/siyuan/issues/6392
|
||||
return
|
||||
}
|
||||
|
||||
if (1 > current && 1 == total) || current == total-1 {
|
||||
current = total
|
||||
}
|
||||
|
||||
current := context["current"]
|
||||
total := context["total"]
|
||||
msg := fmt.Sprintf(Conf.Language(90), current, total, blockCount, hash)
|
||||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
|
|
|
|||
|
|
@ -540,6 +540,7 @@ func checkoutRepo(id string) {
|
|||
}
|
||||
|
||||
FullReindex()
|
||||
ReloadUI()
|
||||
|
||||
if syncEnabled {
|
||||
func() {
|
||||
|
|
@ -1025,12 +1026,15 @@ func syncRepo(exit, byHand bool) (err error) {
|
|||
cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939
|
||||
if needFullReindex(upsertTrees) { // 改进同步后全量重建索引判断 https://github.com/siyuan-note/siyuan/issues/5764
|
||||
FullReindex()
|
||||
if !exit {
|
||||
ReloadUI()
|
||||
}
|
||||
return
|
||||
}
|
||||
incReindex(upserts, removes)
|
||||
|
||||
incReindex(upserts, removes)
|
||||
if !exit {
|
||||
util.ReloadUI()
|
||||
ReloadUI()
|
||||
}
|
||||
|
||||
elapsed = time.Since(start)
|
||||
|
|
|
|||
|
|
@ -251,11 +251,6 @@ func incReindex(upserts, removes []string) {
|
|||
treenode.IndexBlockTree(tree)
|
||||
sql.UpsertTreeQueue(tree)
|
||||
}
|
||||
|
||||
util.PushStatusBar(Conf.Language(58))
|
||||
if needPushRemoveProgress || needPushUpsertProgress {
|
||||
util.PushEndlessProgress(Conf.Language(58))
|
||||
}
|
||||
}
|
||||
|
||||
func SetCloudSyncDir(name string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue