♻️ Improve transaction flush

This commit is contained in:
Daniel 2024-10-22 19:20:44 +08:00
parent 72d1a059ac
commit 8dd0629b9c
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
23 changed files with 69 additions and 82 deletions

View file

@ -223,7 +223,7 @@ func heading2Doc(c *gin.Context) {
return
}
model.WaitForWritingFiles()
model.FlushTxQueue()
luteEngine := util.NewLute()
tree, err := filesys.LoadTree(targetNotebook, targetPath, luteEngine)
if err != nil {
@ -268,7 +268,7 @@ func li2Doc(c *gin.Context) {
return
}
model.WaitForWritingFiles()
model.FlushTxQueue()
luteEngine := util.NewLute()
tree, err := filesys.LoadTree(targetNotebook, targetPath, luteEngine)
if err != nil {
@ -591,7 +591,7 @@ func createDoc(c *gin.Context) {
return
}
model.WaitForWritingFiles()
model.FlushTxQueue()
box := model.Conf.Box(notebook)
pushCreate(box, p, tree.Root.ID, arg)
@ -621,7 +621,7 @@ func createDailyNote(c *gin.Context) {
return
}
model.WaitForWritingFiles()
model.FlushTxQueue()
box := model.Conf.Box(notebook)
luteEngine := util.NewLute()
tree, err := filesys.LoadTree(box.ID, p, luteEngine)
@ -720,7 +720,7 @@ func createDocWithMd(c *gin.Context) {
}
ret.Data = id
model.WaitForWritingFiles()
model.FlushTxQueue()
box := model.Conf.Box(notebook)
b, _ := model.GetBlock(id, nil)
p := b.Path