Update lib/Database.php

Update busytimeout to prevent locks, some more pragmas
This commit is contained in:
Martijn de Boer 2024-11-09 16:51:25 +01:00
parent 597e9c8dfb
commit e02a0b4e50

View file

@ -8,12 +8,16 @@ class Database
if (self::$handle === null) {
self::$handle = new SQLite3(SQLITE_DB);
self::$handle->enableExceptions(true);
self::$handle->busyTimeout(60000);
$initialQueries = [
"PRAGMA journal_mode = WAL",
"PRAGMA synchronous = OFF",
"PRAGMA cache_size = 10000",
"PRAGMA temp_store = MEMORY"
"PRAGMA mmap_size = 30000000000",
"PRAGMA temp_store = MEMORY",
"PRAGMA automatic_index = ON",
"PRAGMA optimize"
];
self::$handle->exec(implode(";", $initialQueries) . ";");