diff --git a/dbutils/insert.go b/dbutils/insert.go index 8963c952..2a7ef8c7 100644 --- a/dbutils/insert.go +++ b/dbutils/insert.go @@ -23,8 +23,6 @@ func genRandomTimestamp(now int64, last30d int64) int64 { return rand.Int63n(last30d) + now } -const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - func genRandomContentTopic(n int) string { topics := []string{"topic1", "topic2", "topic3", "topic4", "topic5"} i := n % 5 @@ -70,6 +68,10 @@ func main() { fmt.Println("Inserting ", N, " records in ", dbName) db, err := newdb(dbName) + if err != nil { + panic(err) + } + query := "INSERT INTO message (id, receiverTimestamp, senderTimestamp, contentTopic, pubsubTopic, payload, version) VALUES (?, ?, ?, ?, ?, ?, ?)" err = createTable(db) diff --git a/waku/persistence/store.go b/waku/persistence/store.go index 3ca6e709..c66c028a 100644 --- a/waku/persistence/store.go +++ b/waku/persistence/store.go @@ -158,6 +158,11 @@ func (d *DBStore) Put(cursor *pb.Index, pubsubTopic string, message *pb.WakuMess return err } + err = stmt.Close() + if err != nil { + return err + } + return nil }