Skip to content

Commit c91c46e

Browse files
committed
Remove cache=shared option for less database is locked errors
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
1 parent 5908e7b commit c91c46e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

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

0 commit comments

Comments
 (0)