Bugfix for broadcastToWebhook

Properly close connections on timeout
This commit is contained in:
Erik 2024-02-06 22:45:07 +02:00
parent dddfe6da75
commit d59e6e11d5
3 changed files with 4 additions and 3 deletions

View File

@ -52,7 +52,7 @@ export type IPCMessage = {
[key: string]: string | number | object | boolean | undefined
}
export type WebhookIPC = { payload: Payload, options: WebhookBroadcastOptions }
export type WebhookIPC = { payload: Payload, options?: WebhookBroadcastOptions }
export type WebhookBroadcastOptions = {
debounce?: { id: string | number, duration: number}

View File

@ -275,7 +275,7 @@ class Controller extends EventEmitter
this.#logger.debug(`Message from ${shard.id}: ${inspect(msg)}`);
}
async broadcastToWebhook ({ payload, options }: WebhookIPC)
async broadcastToWebhook ({ payload, options = {} }: WebhookIPC)
{
if (this.#webhook)
{

View File

@ -567,8 +567,9 @@ class Server extends EventEmitter
setTimeout(() =>
{
this.#logger.warn('Server close timed out, cleaning up and exiting');
this.#server?.closeAllConnections();
cleanUp();
}, 90_000);
}, 10_000);
}
}