Remove auto-restart

It was a work around to reset memory usage, but as I hope mongodb support fixes that, I shall remove it. Hopefully I won't need to revert this commit and put it back!
This commit is contained in:
benji7425 2018-01-27 00:41:58 +00:00
parent 17eb0554fe
commit 19677b7626
2 changed files with 0 additions and 35 deletions

View File

@ -1,8 +1,6 @@
{
"dbConnectionString": "nedb://guilds-data",
"neDBCompactionSchedule": "0 * * * * *",
"restartSchedule": "0 0 0 * * *",
"restartTimeout": 5000,
"website": "https://benji7425.github.io",
"discordInvite": "https://discord.gg/SSkbwSJ",
"debugIgnores": [

View File

@ -1,33 +0,0 @@
const { fork } = require("child_process");
const CronJob = require("cron").CronJob;
const DiscordUtil = require("./util.js");
// @ts-ignore
const InternalConfig = require("./internal-config.json");
let instance;
restart();
new CronJob(InternalConfig.restartSchedule, restart, null, true);
function restart() {
ensureKilledInstance()
.then(bootstrapNewInstance)
.catch(DiscordUtil.dateError);
}
function bootstrapNewInstance() {
instance = fork(process.argv[2]);
}
function ensureKilledInstance() {
return new Promise((resolve, reject) => {
if (instance) {
instance.kill();
DiscordUtil.dateLog(`Killed existing instance for scheduled restart in ${InternalConfig.restartTimeout / 1000} sec`);
setTimeout(resolve, InternalConfig.restartTimeout);
}
else
resolve();
});
}