Verified Commit 68b20486 authored by Luc Everse's avatar Luc Everse
Browse files

Add a SIGTERM handler

parent aeb55309
Pipeline #1756 passed with stage
in 5 minutes and 54 seconds
import fs from 'fs';
import fsPromises from 'fs/promises';
import process from 'process';
import Discord from 'discord.js';
import ssdeep from 'ssdeep.js';
import { parseISO } from 'date-fns';
......@@ -132,7 +133,14 @@ client.on('ready', () => {
logger.log(`Logged in as ${client.user.tag}!`);
cw.start();
setInterval(() => storeConfig(config), 15000);
const storeConfigTimer = setInterval(() => storeConfig(config), 15000);
process.on('SIGTERM', () => {
clearInterval(storeConfigTimer);
cw.stop();
client.destroy();
process.exit();
});
});
client.login(config.loginToken).catch(console.error);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment