mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-13 16:06:13 +01:00
♻️ Improve insert blocktree tx
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
6bb5e423ee
commit
a0a9447458
1 changed files with 8 additions and 3 deletions
|
|
@ -569,6 +569,10 @@ func IndexBlockTree(tree *parse.Tree) {
|
|||
}
|
||||
|
||||
execInsertBlocktrees(tx, tree, changedNodes)
|
||||
|
||||
if err = tx.Commit(); err != nil {
|
||||
logging.LogErrorf("commit transaction failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func UpsertBlockTree(tree *parse.Tree) {
|
||||
|
|
@ -628,6 +632,10 @@ func UpsertBlockTree(tree *parse.Tree) {
|
|||
}
|
||||
|
||||
execInsertBlocktrees(tx, tree, changedNodes)
|
||||
|
||||
if err = tx.Commit(); err != nil {
|
||||
logging.LogErrorf("commit transaction failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func execInsertBlocktrees(tx *sql.Tx, tree *parse.Tree, changedNodes []*ast.Node) {
|
||||
|
|
@ -651,9 +659,6 @@ func execInsertBlocktrees(tx *sql.Tx, tree *parse.Tree, changedNodes []*ast.Node
|
|||
return
|
||||
}
|
||||
}
|
||||
if err = tx.Commit(); err != nil {
|
||||
logging.LogErrorf("commit transaction failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func InitBlockTree(force bool) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue