From 913105f2de24adaab7ce599db46bea1acfc83b14 Mon Sep 17 00:00:00 2001 From: Andreas Wagner Date: Sat, 2 May 2026 14:24:00 +0200 Subject: [PATCH] fix: Add `busy_timeout` to sqlite to avoid error `SQLITE_BUSY: database is locked` (#7307) --- server/database.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/database.js b/server/database.js index 993d1f47c..3c5014013 100644 --- a/server/database.js +++ b/server/database.js @@ -435,6 +435,9 @@ class Database { await asyncRun("PRAGMA cache_size = -12000"); await asyncRun("PRAGMA auto_vacuum = INCREMENTAL"); + // Avoid error "SQLITE_BUSY: database is locked" by allowing SQLITE to wait up to 5 seconds to do a write + await asyncRun("PRAGMA busy_timeout = 5000"); + // This ensures that an operating system crash or power failure will not corrupt the database. // FULL synchronous is very safe, but it is also slower. // Read more: https://sqlite.org/pragma.html#pragma_synchronous