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 {
53
53
}
54
54
55
55
func 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 ... )
57
57
}
58
58
59
59
func newSqliteBackend (dsn string , opts ... option ) * sqliteBackend {
@@ -71,6 +71,15 @@ func newSqliteBackend(dsn string, opts ...option) *sqliteBackend {
71
71
panic (err )
72
72
}
73
73
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
+
74
83
// SQLite does not support multiple writers on the database, see https://www.sqlite.org/faq.html#q5
75
84
// A frequently used workaround is to have a single connection, effectively acting as a mutex
76
85
// See https://github.com/mattn/go-sqlite3/issues/274 for more context
You can’t perform that action at this time.
0 commit comments