From f7e7c8e23f8ba67c92e10bfb92a573b1b450e34f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 30 Apr 2026 14:06:18 +1200 Subject: [PATCH] fix(sqlite): bump busy_timeout to 30s and use synchronous=NORMAL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- app/init/registers.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/init/registers.php b/app/init/registers.php index 14391bed16..6f08d63e39 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -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');