⚡ 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) {
|
||||
refs := sql.QueryRefsByDefID(defID, false)
|
||||
trees := map[string]*parse.Tree{}
|
||||
var rootIDs []string
|
||||
for _, ref := range refs {
|
||||
tree := trees[ref.RootID]
|
||||
if nil != tree {
|
||||
continue
|
||||
}
|
||||
|
||||
var loadErr error
|
||||
tree, loadErr = LoadTreeByBlockID(ref.RootID)
|
||||
if nil != loadErr {
|
||||
logging.LogErrorf("refresh tree refs failed: %s", loadErr)
|
||||
continue
|
||||
}
|
||||
trees[ref.RootID] = tree
|
||||
rootIDs = append(rootIDs, ref.RootID)
|
||||
}
|
||||
trees := filesys.LoadTrees(rootIDs)
|
||||
for _, tree := range trees {
|
||||
sql.UpdateRefsTreeQueue(tree)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue