From 729b80c6bc62ef622b16e4d28602bd5a0fc92fe4 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 14 Oct 2016 16:40:48 +0100 Subject: [PATCH] Set max open conns to 1 on sqlite3 --- src/github.com/matrix-org/go-neb/database/db.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/github.com/matrix-org/go-neb/database/db.go b/src/github.com/matrix-org/go-neb/database/db.go index cdd6ad6..1aaf932 100644 --- a/src/github.com/matrix-org/go-neb/database/db.go +++ b/src/github.com/matrix-org/go-neb/database/db.go @@ -36,6 +36,11 @@ func Open(databaseType, databaseURL string) (serviceDB *ServiceDB, err error) { if _, err = db.Exec(schemaSQL); err != nil { return } + if databaseType == "sqlite3" { + // Fix for "database is locked" errors + // https://github.com/mattn/go-sqlite3/issues/274 + db.SetMaxOpenConns(1) + } serviceDB = &ServiceDB{db: db} return }