Skip to content

Commit

Permalink
Remove cache=shared option for less database is locked errors
Browse files Browse the repository at this point in the history
Inspired by mattn/go-sqlite3#209, but we are
not following their advice because `db.SetMaxOpenConns(1)` destroys our
performance because we require the database queries (and updates) to run
in parallel.

This seems to make the `database is locked` errors go away a bit, at
least in local testing
  • Loading branch information
heyLu committed May 14, 2022
1 parent 5908e7b commit c91c46e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion database.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func InitDatabase(dbPath string) (*sql.DB, error) {
db, err := sql.Open("sqlite3", "file:"+dbPath+"?_journal_mode=WAL&cache=shared&_busy_timeout=50")
db, err := sql.Open("sqlite3", "file:"+dbPath+"?_journal_mode=WAL&_busy_timeout=50")
if err != nil {
return nil, fmt.Errorf("open: %w", err)
}
Expand Down

0 comments on commit c91c46e

Please sign in to comment.