Skip to content

Commit

Permalink
set sqlite connection's max open connections to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
hermitpopcorn committed Mar 19, 2023
1 parent 289c8a2 commit ae98094
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions database/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit ae98094

Please sign in to comment.