fix(sqlite): bump busy_timeout to 30s and use synchronous=NORMAL

E2E test backend was hitting SQLITE_BUSY ("database is locked") under
Swoole's concurrent worker fanout, since SQLite serialises writes through
a single file lock. The previous 5s timeout was too tight for parallel
test load. NORMAL synchronous halves write fsync cost on WAL — fine for
ephemeral test databases.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jake Barnby
2026-04-30 14:06:18 +12:00
co-authored by Claude Opus 4.7
parent 9542af215e
commit f7e7c8e23f
+4 -2
View File
@@ -328,8 +328,9 @@ $register->set('pools', function () {
\PDO::ATTR_STRINGIFY_FETCHES => true,
]);
$pdo->query('PRAGMA journal_mode=WAL');
$pdo->query('PRAGMA busy_timeout=5000');
$pdo->query('PRAGMA busy_timeout=30000');
$pdo->query('PRAGMA foreign_keys=ON');
$pdo->query('PRAGMA synchronous=NORMAL');
return $pdo;
});
},
@@ -435,8 +436,9 @@ $register->set('db', function () {
$path = System::getEnv('_APP_DB_SQLITE_PATH', '/tmp/appwrite.db');
$pdo = new PDO("sqlite:{$path}", null, null, SQL::getPDOAttributes());
$pdo->query('PRAGMA journal_mode=WAL');
$pdo->query('PRAGMA busy_timeout=5000');
$pdo->query('PRAGMA busy_timeout=30000');
$pdo->query('PRAGMA foreign_keys=ON');
$pdo->query('PRAGMA synchronous=NORMAL');
return $pdo;
default:
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Invalid database adapter');