]> code.octet-stream.net Git - broadcaster/blobdiff - server/database.go
Add suitable pragmas for sqlite
[broadcaster] / server / database.go
index e6ce752290c4d7bd8547abda54443ed6f11ccb9d..d6bbf920314e1c75ebeca8b2ba844bdf56f93124 100644 (file)
@@ -21,10 +21,19 @@ func InitDatabase() {
        }
        db.sqldb = sqldb
 
+       _, err = db.sqldb.Exec("PRAGMA journal_mode = WAL")
+       if err != nil {
+               log.Fatal(err)
+       }
+
        _, err = db.sqldb.Exec("PRAGMA foreign_keys = ON")
        if err != nil {
-               log.Printf("%q\n", err)
-               return
+               log.Fatal(err)
+       }
+
+       _, err = db.sqldb.Exec("PRAGMA busy_timeout = 5000")
+       if err != nil {
+               log.Fatal(err)
        }
 
        sqlStmt := `