mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
⚡ Improve performance for refresh refs
This commit is contained in:
parent
4f07f3314a
commit
570a6846b1
1 changed files with 5 additions and 13 deletions
|
|
@ -44,20 +44,12 @@ func RefreshBacklink(id string) {
|
||||||
|
|
||||||
func refreshRefsByDefID(defID string) {
|
func refreshRefsByDefID(defID string) {
|
||||||
refs := sql.QueryRefsByDefID(defID, false)
|
refs := sql.QueryRefsByDefID(defID, false)
|
||||||
trees := map[string]*parse.Tree{}
|
var rootIDs []string
|
||||||
for _, ref := range refs {
|
for _, ref := range refs {
|
||||||
tree := trees[ref.RootID]
|
rootIDs = append(rootIDs, ref.RootID)
|
||||||
if nil != tree {
|
}
|
||||||
continue
|
trees := filesys.LoadTrees(rootIDs)
|
||||||
}
|
for _, tree := range trees {
|
||||||
|
|
||||||
var loadErr error
|
|
||||||
tree, loadErr = LoadTreeByBlockID(ref.RootID)
|
|
||||||
if nil != loadErr {
|
|
||||||
logging.LogErrorf("refresh tree refs failed: %s", loadErr)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
trees[ref.RootID] = tree
|
|
||||||
sql.UpdateRefsTreeQueue(tree)
|
sql.UpdateRefsTreeQueue(tree)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue