diff --git a/core/dbs/NetworkDb.ts b/core/dbs/NetworkDb.ts index 2f86e81ba..0466de6d5 100644 --- a/core/dbs/NetworkDb.ts +++ b/core/dbs/NetworkDb.ts @@ -19,6 +19,8 @@ export default class NetworkDb { constructor() { NetworkDb.createDir(); this.db = new Database(NetworkDb.databasePath); + this.db.unsafeMode(false) + this.db.pragma('journal_mode = WAL'); this.certificates = new CertificatesTable(this.db); this.saveInterval = setInterval(this.flush.bind(this), 5e3).unref(); diff --git a/core/dbs/SessionDb.ts b/core/dbs/SessionDb.ts index 1d9ec5e37..958c00cf4 100644 --- a/core/dbs/SessionDb.ts +++ b/core/dbs/SessionDb.ts @@ -88,6 +88,8 @@ export default class SessionDb { const { readonly = false, fileMustExist = false } = dbOptions; this.sessionId = sessionId; this.db = new Database(`${SessionDb.databaseDir}/${sessionId}.db`, { readonly, fileMustExist }); + this.db.unsafeMode(false); + this.db.pragma('journal_mode = WAL'); if (!readonly) { this.saveInterval = setInterval(this.flush.bind(this), 5e3).unref(); } diff --git a/core/dbs/SessionsDb.ts b/core/dbs/SessionsDb.ts index 4afe50682..dea168af2 100644 --- a/core/dbs/SessionsDb.ts +++ b/core/dbs/SessionsDb.ts @@ -21,6 +21,8 @@ export default class SessionsDb { SessionsDb.createDir(); const { readonly = false, fileMustExist = false } = dbOptions; this.db = new Database(SessionsDb.databasePath, { readonly, fileMustExist }); + this.db.unsafeMode(false); + this.db.pragma('journal_mode = WAL'); this.readonly = readonly; this.sessions = new SessionsTable(this.db); }