From 5306bcb89a33b5a5b75c6697b223b89229afd357 Mon Sep 17 00:00:00 2001 From: Meadowsys Date: Mon, 13 Nov 2023 01:04:14 -0800 Subject: [PATCH] fix some minor shutdown issues --- lib/Application.js | 21 ++++++++++++++------- modules/TimeToGalacon/module.js | 3 --- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/Application.js b/lib/Application.js index ca11ce1..644c3cc 100644 --- a/lib/Application.js +++ b/lib/Application.js @@ -148,17 +148,24 @@ class Application { }); } + /** + * @returns { Promise } + */ static stopModules() { return new Promise((resolve, reject) => { this.log.info("Stopping Modules"); - Promise.all(this.moduleObjs.map(m => m.instance.stop())) - .then(() => { - this.moduleObjs = null; - this.modules = null; - resolve(); - }) - .catch(reject); + if (this.moduleObjs) { + Promise.all(this.moduleObjs.map(m => m.instance.stop())) + .then(() => { + this.moduleObjs = null; + this.modules = null; + resolve(); + }) + .catch(reject); + } else { + resolve(); + } }); } diff --git a/modules/TimeToGalacon/module.js b/modules/TimeToGalacon/module.js index 21c3340..1109172 100644 --- a/modules/TimeToGalacon/module.js +++ b/modules/TimeToGalacon/module.js @@ -26,9 +26,6 @@ module.exports = class CanniTimeToHype extends Module { if (active) { Application.modules.Discord.client.on("ready", () => { this.setGalaconDate(); - setInterval(() => { - this.updateGalaconDate(); - }, (this.config.updateInterval || 10) * 1000); }); }