Set SQLite busy_timeout to prevent lock contention issues

This commit is contained in:
Test 2024-09-04 14:08:38 -07:00
parent af32cffd28
commit 8b57d298dd
4 changed files with 8 additions and 0 deletions

View file

@ -20,6 +20,8 @@ export class AutocompleteLruCache {
driver: sqlite3.Database,
});
db.exec("PRAGMA busy_timeout = 3000;");
await db.run(`
CREATE TABLE IF NOT EXISTS cache (
key TEXT PRIMARY KEY,

View file

@ -475,6 +475,8 @@ export default class DocsService {
driver: sqlite3.Database,
});
db.exec("PRAGMA busy_timeout = 3000;");
await runSqliteMigrations(db);
await db.exec(`CREATE TABLE IF NOT EXISTS ${DocsService.sqlitebTableName} (

View file

@ -92,6 +92,8 @@ export class SqliteDb {
driver: sqlite3.Database,
});
SqliteDb.db.exec("PRAGMA busy_timeout = 3000;");
await SqliteDb.createTables(SqliteDb.db);
return SqliteDb.db;

View file

@ -79,6 +79,8 @@ export class DevDataSqliteDb {
driver: sqlite3.Database,
});
DevDataSqliteDb.db.exec("PRAGMA busy_timeout = 3000;");
await DevDataSqliteDb.createTables(DevDataSqliteDb.db!);
return DevDataSqliteDb.db;