mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Set NORMAL sync on sqlite3 (#1684)
NORMAL sync is safe when using WAL journaliing. It cuts the amount of sync calls to the disk, resulting in faster write operation. On power loss, the database will perhaps lose some ongoing commits, but that is all. The expectation is that if the database lives on the same disk as the stash, this could help performance quite a bit under heavier operation.
This commit is contained in:
@@ -98,7 +98,7 @@ func Close() error {
|
|||||||
|
|
||||||
func open(databasePath string, disableForeignKeys bool) *sqlx.DB {
|
func open(databasePath string, disableForeignKeys bool) *sqlx.DB {
|
||||||
// https://github.com/mattn/go-sqlite3
|
// https://github.com/mattn/go-sqlite3
|
||||||
url := "file:" + databasePath + "?_journal=WAL"
|
url := "file:" + databasePath + "?_journal=WAL&_sync=NORMAL"
|
||||||
if !disableForeignKeys {
|
if !disableForeignKeys {
|
||||||
url += "&_fk=true"
|
url += "&_fk=true"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user