From 5ebb5722519dead680a6a23ba139918bec096385 Mon Sep 17 00:00:00 2001 From: arzumify Date: Sun, 20 Oct 2024 18:39:20 +0100 Subject: [PATCH] Switched to the CGO sqlite driver to fix an out of memory bug Signed-off-by: arzumify --- go.mod | 1 + go.sum | 2 ++ main.go | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 21423d3..cc605a2 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/uuid v1.6.0 github.com/lib/pq v1.10.9 + github.com/mattn/go-sqlite3 v1.14.24 golang.org/x/crypto v0.28.0 modernc.org/sqlite v1.33.1 ) diff --git a/go.sum b/go.sum index 4fe152d..7036fdd 100644 --- a/go.sum +++ b/go.sum @@ -39,6 +39,8 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= +github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/main.go b/main.go index 76ceaab..7486dbd 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ import ( "github.com/google/uuid" _ "github.com/lib/pq" - _ "modernc.org/sqlite" + _ "github.com/mattn/go-sqlite3" ) type Config struct { @@ -94,7 +94,7 @@ func processInterServiceMessage(channel chan library.InterServiceMessage, config // Check if we are using sqlite or postgres if config.Database.DatabaseType == "sqlite" { // Open the database and return the connection - pluginConn, err := sql.Open("sqlite", filepath.Join(config.Database.DatabasePath, message.ServiceID.String()+".db")) + pluginConn, err := sql.Open("sqlite3", filepath.Join(config.Database.DatabasePath, message.ServiceID.String()+".db")) if err != nil { // Report an error services[message.ServiceID].Inbox <- library.InterServiceMessage{