From ca5890e6e35bf63d58e99992b31cdc4ff1617bef Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Thu, 23 Jan 2020 15:00:20 -0500 Subject: [PATCH 1/2] Added WAL mode checkpoint number --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 049a36b..5569fce 100644 --- a/index.js +++ b/index.js @@ -39,6 +39,11 @@ var adminUserID = config.adminUserID; //if so, it will use the x-forwarded header instead of the ip address of the connection var behindProxy = config.behindProxy; +// Enable WAL mode checkpoint number +if (!config.readOnly) { + db.get("PRAGMA wal_autocheckpoint=1"); +} + //setup CORS correctly app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*"); From 938cff5381b8cf7d37cba9a289f257680dc85de3 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Thu, 23 Jan 2020 15:02:55 -0500 Subject: [PATCH 2/2] Now sets the journal mode to wal --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 5569fce..bc60b16 100644 --- a/index.js +++ b/index.js @@ -40,8 +40,9 @@ var adminUserID = config.adminUserID; var behindProxy = config.behindProxy; // Enable WAL mode checkpoint number -if (!config.readOnly) { - db.get("PRAGMA wal_autocheckpoint=1"); +if (!config.readOnly && config.mode === "production") { + db.get("PRAGMA journal_mode=WAL;"); + db.get("PRAGMA wal_autocheckpoint=1;"); } //setup CORS correctly