This commit is contained in:
Erik 2023-12-10 23:04:28 +02:00
parent 4ab7f33767
commit 55aafa5cb7

View File

@ -130,8 +130,9 @@ class Shard extends EventEmitter
return new Promise((resolve, reject) =>
{
const cleanup = () =>
const cleanup = (kill?: boolean) =>
{
if (kill)
this.#process?.kill();
clearTimeout(spawnTimeoutTimer); // eslint-disable-line @typescript-eslint/no-use-before-define
this.off('ready', onReady); // eslint-disable-line @typescript-eslint/no-use-before-define
@ -147,7 +148,7 @@ class Shard extends EventEmitter
const onDisconnect = () =>
{
cleanup();
cleanup(true);
reject(new Error(`[shard${this.id}] Shard disconnected while readying.`));
};
@ -159,7 +160,7 @@ class Shard extends EventEmitter
const onTimeout = () =>
{
cleanup();
cleanup(true);
reject(new Error(`[shard${this.id}] Shard timed out while readying.`));
};
@ -428,7 +429,7 @@ class Shard extends EventEmitter
if (code !== 0)
{
this.#crashes.push(Date.now() - this.spawnedAt);
this.emit('warn', 'Shard exited with non-zero exit code');
this.emit('warn', 'Shard exited with non-zero exit code: ' + code);
}
this.#ready = false;