From 7b05ed82b2372b626fe0e483e60728e53b139002 Mon Sep 17 00:00:00 2001
From: Daniel <dhaavi@users.noreply.github.com>
Date: Fri, 4 Apr 2025 13:52:50 +0200
Subject: [PATCH] Add a 3s busy timeout to SQLite database backend

---
 base/database/storage/sqlite/sqlite.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/base/database/storage/sqlite/sqlite.go b/base/database/storage/sqlite/sqlite.go
index c6288322..fcf52a6f 100644
--- a/base/database/storage/sqlite/sqlite.go
+++ b/base/database/storage/sqlite/sqlite.go
@@ -80,6 +80,7 @@ func openSQLite(name, location string, printStmts bool) (*SQLite, error) {
 		"PRAGMA journal_mode=WAL;",   // Corruption safe write ahead log for txs.
 		"PRAGMA synchronous=NORMAL;", // Best for WAL.
 		"PRAGMA cache_size=-10000;",  // 10MB Cache.
+		"PRAGMA busy_timeout=3000;",  // 3s (3000ms) timeout for locked tables.
 	}
 	for _, pragma := range pragmas {
 		_, err := db.Exec(pragma)