♻️ Improve insert blocktree tx

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-03-09 10:47:04 +08:00
parent 6bb5e423ee
commit a0a9447458
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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) {