From 5f183f5f38996b8f42fd33f85ef72a3683c53e55 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 7 Jul 2022 20:29:28 +0300 Subject: [PATCH] Improve web-ui and js-executor microservices gracefull shutdown --- msa/js-executor/server.ts | 2 +- msa/web-ui/server.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/msa/js-executor/server.ts b/msa/js-executor/server.ts index 446f9d34aa..035bf77183 100644 --- a/msa/js-executor/server.ts +++ b/msa/js-executor/server.ts @@ -69,7 +69,7 @@ async function createQueue(serviceType: string): Promise { } [`SIGINT`, `SIGUSR1`, `SIGUSR2`, `uncaughtException`, `SIGTERM`].forEach((eventType) => { - process.on(eventType, async () => { + process.once(eventType, async () => { logger.info(`${eventType} signal received`); await exit(0); }) diff --git a/msa/web-ui/server.ts b/msa/web-ui/server.ts index 2aafe879d1..5ba56add1a 100644 --- a/msa/web-ui/server.ts +++ b/msa/web-ui/server.ts @@ -123,7 +123,7 @@ let connections: Socket[] = []; })(); [`SIGINT`, `SIGUSR1`, `SIGUSR2`, `uncaughtException`, `SIGTERM`].forEach((eventType) => { - process.on(eventType, async () => { + process.once(eventType, async () => { logger.info(`${eventType} signal received`); await exit(0); });