please work god dammit

This commit is contained in:
Essem 2022-10-31 13:09:21 -05:00
parent b098499c67
commit 21f3047ad4
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C

View file

@ -224,8 +224,14 @@ function calcShards(shards, procs) {
const shardArrays = calcShards(shardArray, procAmount); const shardArrays = calcShards(shardArray, procAmount);
for (let i = 0; i < shardArrays.length; i++) { for (let i = 0; i < shardArrays.length; i++) {
await awaitStart(i, shardArrays);
}
})();
function awaitStart(i, shardArrays) {
return new Promise((resolve) => {
pm2.start({ pm2.start({
name: "esmBot", name: `esmBot-${i}`,
script: "app.js", script: "app.js",
autorestart: true, autorestart: true,
exp_backoff_restart_delay: 1000, exp_backoff_restart_delay: 1000,
@ -243,7 +249,8 @@ function calcShards(shards, procs) {
process.exit(0); process.exit(0);
} else { } else {
logger.info(`Started esmBot process ${i}.`); logger.info(`Started esmBot process ${i}.`);
resolve();
} }
}); });
} });
})(); }