mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-11 03:36:37 +08:00
Merge pull request #89 from Sagit-chu/opencode/lucky-otter
fix(store): enable WAL mode and busy timeout to prevent SQLITE_BUSY
This commit is contained in:
@@ -165,7 +165,13 @@ func Open(path string) (*Repository, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
db, err := sql.Open("sqlite", path)
|
// Use _pragma DSN parameters so every connection from the pool gets
|
||||||
|
// the same settings (busy_timeout and synchronous are per-connection).
|
||||||
|
dsn := "file:" + path +
|
||||||
|
"?_pragma=busy_timeout(5000)" +
|
||||||
|
"&_pragma=journal_mode(WAL)" +
|
||||||
|
"&_pragma=synchronous(NORMAL)"
|
||||||
|
db, err := sql.Open("sqlite", dsn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user