please work god dammit
This commit is contained in:
parent
b098499c67
commit
21f3047ad4
1 changed files with 10 additions and 3 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})();
|
|
Loading…
Reference in a new issue