From ca52047bf5ea27a37adbb0affa8ab1c2e2067fa2 Mon Sep 17 00:00:00 2001 From: Nelson Chan Date: Wed, 15 Feb 2023 15:30:28 +0800 Subject: [PATCH] Feat: Flush WAL on shutdown --- server/database.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/database.js b/server/database.js index e52ae8bfc..8a088c941 100644 --- a/server/database.js +++ b/server/database.js @@ -434,6 +434,9 @@ class Database { log.info("db", "Closing the database"); + // Flush WAL to main database + await R.exec("PRAGMA wal_checkpoint(TRUNCATE)"); + while (true) { Database.noReject = true; await R.close();