From e82763b512abd743de69c4b9b85b344fea108e2d Mon Sep 17 00:00:00 2001 From: KagChi Date: Wed, 21 Feb 2024 19:53:29 +0700 Subject: [PATCH] fix: listen to worker error --- .../src/Utilities/WebSockets/ProcessShardingStrategy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/services/kanao-gateway/src/Utilities/WebSockets/ProcessShardingStrategy.ts b/services/kanao-gateway/src/Utilities/WebSockets/ProcessShardingStrategy.ts index a7db9061..352c1628 100644 --- a/services/kanao-gateway/src/Utilities/WebSockets/ProcessShardingStrategy.ts +++ b/services/kanao-gateway/src/Utilities/WebSockets/ProcessShardingStrategy.ts @@ -222,6 +222,7 @@ export class ProcessShardingStrategy implements IShardingStrategy { }).catch(error => setTimeout(() => { this.logger.error(error, "Error when starting worker !"); const worker = this.#workerByShardId.get(workerData.shardIds[0])!; + worker.on("error", error => this.logger.error({ error, shardIds: workerData.shardIds }, "process emitted error !")); this.#workers.splice(this.#workers.indexOf(worker), 1); this.restartWorker(workerData); }, 5_000));