From 3456dfbd86a5771b0e840b2d9628809e70a9a7c5 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Mon, 2 Oct 2023 11:40:00 -0700 Subject: [PATCH] handle siginit and sigterm --- backend/src/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 2a5159738..994e24cc1 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -225,8 +225,19 @@ const main = async () => { server.on("close", async () => { await DatabaseService.closeDatabase(); - syncSecretsToThirdPartyServices.close(); - githubPushEventSecretScan.close(); + // TODO: prevent queue from trying to reconnect with redis after .close + syncSecretsToThirdPartyServices.close() + githubPushEventSecretScan.close() + }); + + process.on("SIGINT", function () { + server.close(); + process.exit(0); + }); + + process.on("SIGTERM", function () { + server.close(); + process.exit(0); }); return server;