Browse Source

Set max open conns to 1 on sqlite3

kegan/rss-user-agent
Kegan Dougal 8 years ago
parent
commit
729b80c6bc
  1. 5
      src/github.com/matrix-org/go-neb/database/db.go

5
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 { if _, err = db.Exec(schemaSQL); err != nil {
return 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} serviceDB = &ServiceDB{db: db}
return return
} }

Loading…
Cancel
Save