Skip to content

Commit

Permalink
chore: clean up logging
Browse files Browse the repository at this point in the history
  • Loading branch information
larwaa committed Jan 11, 2024
1 parent f66ff11 commit d22a190
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ export function initWorkers() {
{ subject: string; receiverId: string },
{ status: string },
"welcome" | "waitlist"
>("email", MailWorker(mailService, userRepository), {
>("email", MailWorker(mailService, userRepository, logger), {
connection: redis,
}).on("ready", () => {
logger.info("Mail worker ready");
});

const gracefulShutdown = async (signal: "SIGINT" | "SIGTERM") => {
console.log(`Received ${signal}, closing server...`);
logger.info(`Received ${signal}, closing server...`);
await worker.close();
await redis.quit();
process.exit(0);
};

process.on("SIGINT", () => gracefulShutdown("SIGINT"));

process.on("SIGTERM", () => gracefulShutdown("SIGTERM"));
}

Check warning on line 39 in src/worker.ts

View check run for this annotation

Codecov / codecov/patch

src/worker.ts#L2-L39

Added lines #L2 - L39 were not covered by tests

0 comments on commit d22a190

Please sign in to comment.