From cee1f487d5e648d467d0c81d95022234a43b5917 Mon Sep 17 00:00:00 2001 From: Navy Date: Sun, 20 Jun 2021 01:02:27 +0300 Subject: [PATCH] slow down cache saving for prod --- structure/Client.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/structure/Client.js b/structure/Client.js index 8704f75..31b30f6 100644 --- a/structure/Client.js +++ b/structure/Client.js @@ -56,7 +56,12 @@ class ModmailClient extends Client { this.logger.info(`Starting up modmail handler`); this.modmail.init(); - process.on('exit', this.saveCache.bind(this)); + process.on('exit', () => { + this.saveCache(); + this.modmail.saveHistory(); + // eslint-disable-next-line no-process-exit + process.exit(); + }); process.on('SIGINT', () => { this.saveCache.bind(this); this.modmail.saveHistory(); @@ -66,7 +71,7 @@ class ModmailClient extends Client { this._ready = true; - this.cacheSaver = setInterval(this.saveCache.bind(this), 1 * 60 * 1000); + this.cacheSaver = setInterval(this.saveCache.bind(this), 10 * 60 * 1000); }