File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ func NewInMemoryBackend(opts ...option) *sqliteBackend {
5353}
5454
5555func NewSqliteBackend (path string , opts ... option ) * sqliteBackend {
56- return newSqliteBackend (fmt .Sprintf ("file:%v?_mutex=no&_journal=wal " , path ), opts ... )
56+ return newSqliteBackend (fmt .Sprintf ("file:%v" , path ), opts ... )
5757}
5858
5959func newSqliteBackend (dsn string , opts ... option ) * sqliteBackend {
@@ -71,6 +71,15 @@ func newSqliteBackend(dsn string, opts ...option) *sqliteBackend {
7171 panic (err )
7272 }
7373
74+ // Set WAL mode via PRAGMA
75+ if _ , err := db .Exec ("PRAGMA journal_mode=WAL;" ); err != nil {
76+ panic (err )
77+ }
78+
79+ if _ , err = db .Exec ("PRAGMA busy_timeout = 5000;" ); err != nil {
80+ panic (err )
81+ }
82+
7483 // SQLite does not support multiple writers on the database, see https://www.sqlite.org/faq.html#q5
7584 // A frequently used workaround is to have a single connection, effectively acting as a mutex
7685 // See https://github.com/mattn/go-sqlite3/issues/274 for more context
You can’t perform that action at this time.
0 commit comments