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); +});