forked from Galactic/galactic-bot
whoops
This commit is contained in:
parent
4ab7f33767
commit
55aafa5cb7
@ -130,9 +130,10 @@ class Shard extends EventEmitter
|
|||||||
|
|
||||||
return new Promise((resolve, reject) =>
|
return new Promise((resolve, reject) =>
|
||||||
{
|
{
|
||||||
const cleanup = () =>
|
const cleanup = (kill?: boolean) =>
|
||||||
{
|
{
|
||||||
this.#process?.kill();
|
if (kill)
|
||||||
|
this.#process?.kill();
|
||||||
clearTimeout(spawnTimeoutTimer); // eslint-disable-line @typescript-eslint/no-use-before-define
|
clearTimeout(spawnTimeoutTimer); // eslint-disable-line @typescript-eslint/no-use-before-define
|
||||||
this.off('ready', onReady); // eslint-disable-line @typescript-eslint/no-use-before-define
|
this.off('ready', onReady); // eslint-disable-line @typescript-eslint/no-use-before-define
|
||||||
this.off('disconnect', onDisconnect); // eslint-disable-line @typescript-eslint/no-use-before-define
|
this.off('disconnect', onDisconnect); // eslint-disable-line @typescript-eslint/no-use-before-define
|
||||||
@ -147,7 +148,7 @@ class Shard extends EventEmitter
|
|||||||
|
|
||||||
const onDisconnect = () =>
|
const onDisconnect = () =>
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup(true);
|
||||||
reject(new Error(`[shard${this.id}] Shard disconnected while readying.`));
|
reject(new Error(`[shard${this.id}] Shard disconnected while readying.`));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -159,7 +160,7 @@ class Shard extends EventEmitter
|
|||||||
|
|
||||||
const onTimeout = () =>
|
const onTimeout = () =>
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup(true);
|
||||||
reject(new Error(`[shard${this.id}] Shard timed out while readying.`));
|
reject(new Error(`[shard${this.id}] Shard timed out while readying.`));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -428,7 +429,7 @@ class Shard extends EventEmitter
|
|||||||
if (code !== 0)
|
if (code !== 0)
|
||||||
{
|
{
|
||||||
this.#crashes.push(Date.now() - this.spawnedAt);
|
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;
|
this.#ready = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user