Merge pull request #2184 from rootedbox/sql_time_out

Set SQLite busy_timeout to prevent lock contention issues
This commit is contained in:
Nate Sesti 2024-09-06 14:17:42 -07:00 • committed by GitHub
commit c6175171f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 0 deletions

View file

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

View file

@ -484,6 +484,8 @@ export default class DocsService {
driver: sqlite3.Database,
});
await 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,
});
await 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,
});
await DevDataSqliteDb.db.exec("PRAGMA busy_timeout = 3000;");
await DevDataSqliteDb.createTables(DevDataSqliteDb.db!);
return DevDataSqliteDb.db;