mirror of https://github.com/Xhofe/alist
perf: optimize sqlite3 (#3074)
- use journal mode to WAL - set locking mode to EXCLUSIVE - set auto vacuum ref: - https://www.sqlite.org/pragma.html#pragma_journal_mode - https://www.sqlite.org/pragma.html#pragma_locking_mode - https://www.sqlite.org/pragma.html#pragma_auto_vacuumpull/3078/head
parent
8df1455f25
commit
9c7e451c03
|
@ -51,7 +51,8 @@ func InitDB() {
|
|||
if !(strings.HasSuffix(database.DBFile, ".db") && len(database.DBFile) > 3) {
|
||||
log.Fatalf("db name error.")
|
||||
}
|
||||
dB, err = gorm.Open(sqlite.Open(database.DBFile), gormConfig)
|
||||
dB, err = gorm.Open(sqlite.Open(fmt.Sprintf("%s?_journal=WAL&_locking=EXCLUSIVE&_vacuum=incremental",
|
||||
database.DBFile)), gormConfig)
|
||||
}
|
||||
case "mysql":
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue