Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Add some sqlite optimizations

Gabe Kangas63bd7954478e
diff --git a/core/data/data.go b/core/data/data.go
index 1bed7b28de..7ca0108001 100644
--- a/core/data/data.go
+++ b/core/data/data.go
@@ -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 = 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()
createUsersTable(db)