Vectrum
Sign In

Set the registry database's busy timeout before the other pragmas

next build opens registry.db in several workers at once, and switching to WAL
before the timeout was set failed at once with "database is locked".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JjohannSocommitted 1 parent 9f3f615commit334acc3

Showing 1 changed file with 2 additions and 1 deletion.

+2−1apps/web/lib/registry.tsView File
@@ -112,7 +112,8 @@ CREATE TABLE IF NOT EXISTS registry_tags (
112112 function open() {
113113 mkdirSync(DATA_ROOT, { recursive: true });
114114 const db = new DatabaseSync(path.join(DATA_ROOT, "registry.db"));
115- db.exec("PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON; PRAGMA busy_timeout = 5000;");
115+ // The timeout first, so the rest waits for the lock: next build opens this in several workers at once.
116+ db.exec("PRAGMA busy_timeout = 5000; PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;");
116117 db.exec(SCHEMA);
117118 return db;
118119 }