Commit fa672dc2 authored by ale's avatar ale
Browse files

Limit sqlite driver to 1 concurrent connection

See https://github.com/mattn/go-sqlite3/issues/209 for reference.
parent 0a281cb6
Pipeline #23956 passed with stages
in 1 minute and 57 seconds
......@@ -20,7 +20,7 @@ import (
func openDB(dbDriver, dbURI string) (*sql.DB, error) {
if dbDriver == "sqlite3" && !strings.Contains(dbURI, "?") {
dbURI += "?cache=shared&_busy_timeout=10000&_journal=WAL&_mutex=full"
dbURI += "?_busy_timeout=10000&_journal=WAL&_mutex=full"
}
db, err := sql.Open(dbDriver, dbURI)
......@@ -33,6 +33,10 @@ func openDB(dbDriver, dbURI string) (*sql.DB, error) {
return nil, err
}
// Limit the pool to a single connection.
// https://github.com/mattn/go-sqlite3/issues/209
db.SetMaxOpenConns(1)
return db, nil
}
......@@ -56,7 +60,7 @@ func runDatabaseMigrations(db *sql.DB, dbDriver string) error {
di, err := msqlite3.WithInstance(db, &msqlite3.Config{
MigrationsTable: msqlite3.DefaultMigrationsTable,
DatabaseName: "usermetadb",
DatabaseName: "tabacco",
})
if err != nil {
return err
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment