[WIKI-704] fix: disable exiting on unhandled rejection/exception #7902

This commit is contained in:
M. Palanikannan 2025-10-03 16:10:21 +05:30 committed by GitHub
parent 269fc0d9e0
commit 431af01483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,26 +18,26 @@ startServer();
// Graceful shutdown on unhandled rejection
process.on("unhandledRejection", async (err: Error) => {
logger.error(`UNHANDLED REJECTION! 💥 Shutting down...`, err);
logger.error(`UNHANDLED REJECTION!`, err);
try {
if (server) {
await server.destroy();
}
// if (server) {
// await server.destroy();
// }
} finally {
logger.info("Exiting process...");
process.exit(1);
// logger.info("Exiting process...");
// process.exit(1);
}
});
// Graceful shutdown on uncaught exception
process.on("uncaughtException", async (err: Error) => {
logger.error(`UNCAUGHT EXCEPTION! 💥 Shutting down...`, err);
logger.error(`UNCAUGHT EXCEPTION!`, err);
try {
if (server) {
await server.destroy();
}
// if (server) {
// await server.destroy();
// }
} finally {
logger.info("Exiting process...");
process.exit(1);
// logger.info("Exiting process...");
// process.exit(1);
}
});