From ae98094b6671c8db80b2682f4ffe8babe99a31b7 Mon Sep 17 00:00:00 2001 From: hermitpopcorn Date: Sun, 19 Mar 2023 13:00:28 +0700 Subject: [PATCH] set sqlite connection's max open connections to 1 https://github.com/mattn/go-sqlite3/issues/274#issuecomment-191597862 --- database/sqlite.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/database/sqlite.go b/database/sqlite.go index 4b20580..c092171 100644 --- a/database/sqlite.go +++ b/database/sqlite.go @@ -45,6 +45,10 @@ func OpenSQLiteDatabase(file string) (*SQLiteDatabase, error) { return &db, err } + // Prevent lock-up by "wrapping mutex around every DB access" + // https://github.com/mattn/go-sqlite3/issues/274#issuecomment-191597862 + db.connection.SetMaxOpenConns(1) + return &db, nil }