fix: closing client in cron.ts
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user