🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
This commit is contained in:
parent
72093f7e2e
commit
a452015ded
3 changed files with 5 additions and 25 deletions
|
@ -393,7 +393,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||
continue
|
||||
}
|
||||
|
||||
treenode.IndexBlockTree(tree)
|
||||
treenode.ReindexBlockTree(tree)
|
||||
sql.UpsertTreeQueue(tree)
|
||||
}
|
||||
|
||||
|
|
|
@ -86,11 +86,13 @@ func index(boxID string) {
|
|||
updated := util.TimeFromID(tree.Root.ID)
|
||||
tree.Root.SetIALAttr("updated", updated)
|
||||
docIAL["updated"] = updated
|
||||
writeJSONQueue(tree)
|
||||
if writeErr := filesys.WriteTree(tree); nil != writeErr {
|
||||
logging.LogErrorf("write tree [%s] failed: %s", tree.Path, writeErr)
|
||||
}
|
||||
}
|
||||
|
||||
cache.PutDocIAL(file.path, docIAL)
|
||||
treenode.IndexBlockTree(tree)
|
||||
treenode.ReindexBlockTree(tree)
|
||||
sql.UpsertTreeQueue(tree)
|
||||
|
||||
util.IncBootProgress(bootProgressPart, fmt.Sprintf(Conf.Language(92), util.ShortPathForBootingDisplay(tree.Path)))
|
||||
|
|
|
@ -320,28 +320,6 @@ func ReindexBlockTree(tree *parse.Tree) {
|
|||
blockTreesChanged = true
|
||||
}
|
||||
|
||||
func IndexBlockTree(tree *parse.Tree) {
|
||||
blockTreesLock.Lock()
|
||||
defer blockTreesLock.Unlock()
|
||||
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering || !n.IsBlock() {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
var parentID string
|
||||
if nil != n.Parent {
|
||||
parentID = n.Parent.ID
|
||||
}
|
||||
if "" == n.ID {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
blockTrees[n.ID] = &BlockTree{ID: n.ID, ParentID: parentID, RootID: tree.ID, BoxID: tree.Box, Path: tree.Path, HPath: tree.HPath, Updated: tree.Root.IALAttr("updated")}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
||||
// 新建索引不变更持久化文件,调用处会负责调用 SaveBlockTree()
|
||||
}
|
||||
|
||||
func AutoFlushBlockTree() {
|
||||
for {
|
||||
SaveBlockTree(false)
|
||||
|
|
Loading…
Add table
Reference in a new issue