From 67a69ccf956c6d1aec00f0899475ecd10449e13f Mon Sep 17 00:00:00 2001 From: John Yeo Date: Fri, 25 Jul 2025 20:24:51 +0100 Subject: [PATCH] fix: closing client in cron.ts --- server/src/cron.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/src/cron.ts b/server/src/cron.ts index 4add1f3aa..5ccbae816 100644 --- a/server/src/cron.ts +++ b/server/src/cron.ts @@ -269,7 +269,7 @@ export const cronTask = async () => { return; } - await client.end(); + // await client.end(); }; const job = new CronJob( @@ -285,3 +285,15 @@ const job = new CronJob( // job.start(); cronTask(); + +process.on("SIGTERM", async () => { + console.log("Received SIGTERM signal, closing database connection..."); + await client.end(); + process.exit(0); +}); + +process.on("SIGINT", async () => { + console.log("Received SIGINT signal, closing database connection..."); + await client.end(); + process.exit(0); +});