fix: closing client in cron.ts

This commit is contained in:
John Yeo
2025-07-25 20:24:51 +01:00
parent b910d45a2c
commit 67a69ccf95

View File

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