🎨 Reduce the probability of tree not found when deleting/renaming tags https://github.com/siyuan-note/siyuan/issues/14591

This commit is contained in:
Daniel 2025-04-13 17:47:40 +08:00
parent b66558059d
commit 6c60a3726f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 6 additions and 7 deletions

View file

@ -178,8 +178,6 @@ var (
)
func LoadTreeByBlockIDWithReindex(id string) (ret *parse.Tree, err error) {
// 仅提供给 getBlockInfo 接口使用
if "" == id {
logging.LogWarnf("block id is empty")
return nil, ErrTreeNotFound
@ -192,8 +190,9 @@ func LoadTreeByBlockIDWithReindex(id string) (ret *parse.Tree, err error) {
return
}
// 尝试从文件系统加载
searchTreeInFilesystem(id)
// 尝试从文件系统加载并建立索引
indexTreeInFilesystem(id)
bt = treenode.GetBlockTree(id)
if nil == bt {
if "dev" == util.Mode {
@ -243,7 +242,7 @@ func loadTreeByBlockTree(bt *treenode.BlockTree) (ret *parse.Tree, err error) {
var searchTreeLimiter = rate.NewLimiter(rate.Every(3*time.Second), 1)
func searchTreeInFilesystem(rootID string) {
func indexTreeInFilesystem(rootID string) {
if !searchTreeLimiter.Allow() {
return
}