From 339020a282877aa49d71b5d4b6564fea9a47e8f1 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 19 Dec 2023 16:40:36 +0800 Subject: [PATCH] :art: Improve kernel stability https://github.com/siyuan-note/siyuan/issues/9912 --- kernel/api/filetree.go | 4 +++- kernel/model/file.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go index bac16c6cc..fb92337f5 100644 --- a/kernel/api/filetree.go +++ b/kernel/api/filetree.go @@ -432,6 +432,7 @@ func createDoc(c *gin.Context) { return } + model.WaitForWritingFiles() box := model.Conf.Box(notebook) pushCreate(box, p, tree.Root.ID, arg) @@ -461,8 +462,8 @@ func createDailyNote(c *gin.Context) { return } - box := model.Conf.Box(notebook) model.WaitForWritingFiles() + box := model.Conf.Box(notebook) luteEngine := util.NewLute() tree, err := filesys.LoadTree(box.ID, p, luteEngine) if nil != err { @@ -549,6 +550,7 @@ func createDocWithMd(c *gin.Context) { } ret.Data = id + model.WaitForWritingFiles() box := model.Conf.Box(notebook) b, _ := model.GetBlock(id, nil) p := b.Path diff --git a/kernel/model/file.go b/kernel/model/file.go index c9b4153ce..7b63db4a6 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -1015,6 +1015,7 @@ func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Tree return } + WaitForWritingFiles() ChangeFileTreeSort(box.ID, sorts) return } @@ -1033,6 +1034,7 @@ func CreateWithMarkdown(boxID, hPath, md, parentID, id string) (retID string, er luteEngine := util.NewLute() dom := luteEngine.Md2BlockDOM(md, false) retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id) + WaitForWritingFiles() return }