Add some sqlite optimizations
This commit is contained in:
parent
f20aa4478d
commit
8b2747e4d7
@ -45,10 +45,16 @@ func SetupPersistence(file string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?_cache_size=10000", file))
|
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?_cache_size=10000&cache=shared&_journal_mode=WAL", file))
|
||||||
db.SetMaxOpenConns(1)
|
db.SetMaxOpenConns(1)
|
||||||
_db = db
|
_db = db
|
||||||
|
|
||||||
|
// Some SQLite optimizations
|
||||||
|
_, _ = db.Exec("pragma journal_mode = WAL")
|
||||||
|
_, _ = db.Exec("pragma synchronous = normal")
|
||||||
|
_, _ = db.Exec("pragma temp_store = memory")
|
||||||
|
_, _ = db.Exec("pragma wal_checkpoint(full)")
|
||||||
|
|
||||||
createWebhooksTable()
|
createWebhooksTable()
|
||||||
createUsersTable(db)
|
createUsersTable(db)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user