]> code.octet-stream.net Git - broadcaster/commitdiff
Add suitable pragmas for sqlite
authorThomas Karpiniec <tom.karpiniec@outlook.com>
Sat, 19 Oct 2024 03:31:10 +0000 (14:31 +1100)
committerThomas Karpiniec <tom.karpiniec@outlook.com>
Sat, 19 Oct 2024 03:31:10 +0000 (14:31 +1100)
.gitignore
server/database.go

index 97571d1dec5e9769a5f4c304a26764d16f29d32b..c2f7731796782178df6737b516ecc6a74800019d 100644 (file)
@@ -3,4 +3,4 @@ broadcaster-server
 broadcaster-radio
 test-server.conf
 test-radio.conf
-test.db
+test.db*
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 := `