From 0b38a980d224e0a6d19e1b80c588433c84bdd04d Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Thu, 20 Nov 2025 07:39:16 +0100 Subject: [PATCH] Port importer to new transaction api --- internal/importer/initDB.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/importer/initDB.go b/internal/importer/initDB.go index 98dca03..b81a464 100644 --- a/internal/importer/initDB.go +++ b/internal/importer/initDB.go @@ -55,7 +55,18 @@ func InitDB() error { // Bundle 100 inserts into one transaction for better performance if i%100 == 0 { - r.TransactionCommit(t) + if i > 0 { + if err := t.Commit(); err != nil { + cclog.Errorf("transaction commit error: %v", err) + return err + } + // Start a new transaction for the next batch + t, err = r.TransactionInit() + if err != nil { + cclog.Errorf("transaction init error: %v", err) + return err + } + } fmt.Printf("%d jobs inserted...\r", i) }