Fix server

### Issue:  process.listenerCount()
This commit is contained in:
2026-03-13 16:44:25 +08:00
parent 0eb31073b7
commit cd3a9cc223

View File

@@ -46,10 +46,15 @@ async function gracefulShutdown(): Promise<void> {
} }
// Register shutdown handlers (hanya di environment Node.js) // Register shutdown handlers (hanya di environment Node.js)
// Cegah duplikasi listener dengan cek listenerCount terlebih dahulu
if (typeof process !== "undefined") { if (typeof process !== "undefined") {
if (process.listenerCount("SIGINT") === 0) {
process.on("SIGINT", gracefulShutdown); process.on("SIGINT", gracefulShutdown);
}
if (process.listenerCount("SIGTERM") === 0) {
process.on("SIGTERM", gracefulShutdown); process.on("SIGTERM", gracefulShutdown);
} }
}
export default prisma; export default prisma;
export { prisma }; export { prisma };