🎨 避免启动时重复全量重建索引 Fix https://github.com/siyuan-note/siyuan/issues/6950

This commit is contained in:
Liang Ding 2022-12-30 01:07:07 +08:00
parent 99f16b2a7a
commit 40bbc6cc98
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 7 additions and 7 deletions

View file

@ -562,7 +562,7 @@ func FullReindex() {
openedBox.Index(true)
}
IndexRefs()
treenode.SaveBlockTree()
treenode.SaveBlockTree(true)
InitFlashcards()
util.PushEndlessProgress(Conf.Language(58))

View file

@ -424,7 +424,7 @@ func Close(force bool, execInstallPkg int) (exitCode int) {
Conf.Close()
sql.CloseDatabase()
treenode.SaveBlockTree()
treenode.SaveBlockTree(false)
clearWorkspaceTemp()
clearPortJSON()
util.UnlockWorkspace()
@ -601,7 +601,7 @@ func InitBoxes() {
}
if !initialized {
treenode.SaveBlockTree()
treenode.SaveBlockTree(true)
}
var dbSize string

View file

@ -199,7 +199,7 @@ func Mount(boxID string) (alreadyMount bool, err error) {
IndexRefs()
// 缓存根一级的文档树展开
ListDocTree(box.ID, "/", Conf.FileTree.Sort)
treenode.SaveBlockTree()
treenode.SaveBlockTree(false)
util.ClearPushProgress(100)
if reMountGuide {
return true, nil

View file

@ -259,7 +259,7 @@ func IndexBlockTree(tree *parse.Tree) {
func AutoFlushBlockTree() {
for {
SaveBlockTree()
SaveBlockTree(false)
time.Sleep(7 * time.Second)
}
}
@ -307,8 +307,8 @@ func InitBlockTree(force bool) {
return
}
func SaveBlockTree() {
if !blockTreesChanged {
func SaveBlockTree(force bool) {
if !force && !blockTreesChanged {
return
}