mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
This commit is contained in:
parent
5a09669d3a
commit
9474f558ad
2 changed files with 24 additions and 4 deletions
|
|
@ -1253,10 +1253,9 @@ func autoFixIndex() {
|
||||||
})
|
})
|
||||||
|
|
||||||
size := len(paths)
|
size := len(paths)
|
||||||
for i, p := range paths {
|
missingPaths := treenode.GetNotExistPaths(box.ID, paths)
|
||||||
if nil == treenode.GetBlockTreeRootByPath(box.ID, p) {
|
for i, p := range missingPaths {
|
||||||
reindexTreeByPath(box.ID, p, i, size)
|
reindexTreeByPath(box.ID, p, i, size)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,27 @@ func CeilBlockCount(count int) int {
|
||||||
return 10000*100 + 1
|
return 10000*100 + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetNotExistPaths(boxID string, paths []string) (ret []string) {
|
||||||
|
blockTreesLock.Lock()
|
||||||
|
defer blockTreesLock.Unlock()
|
||||||
|
|
||||||
|
pathsMap := map[string]bool{}
|
||||||
|
for _, path := range paths {
|
||||||
|
pathsMap[path] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, blockTree := range blockTrees {
|
||||||
|
if blockTree.BoxID != boxID {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if !pathsMap[blockTree.Path] {
|
||||||
|
ret = append(ret, blockTree.Path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetBlockTreeRootByPath(boxID, path string) *BlockTree {
|
func GetBlockTreeRootByPath(boxID, path string) *BlockTree {
|
||||||
blockTreesLock.Lock()
|
blockTreesLock.Lock()
|
||||||
defer blockTreesLock.Unlock()
|
defer blockTreesLock.Unlock()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue