This commit is contained in:
Baobhan Sith
2025-04-30 13:00:38 +08:00
parent 7b4bc55dd3
commit 82d516afd2
3 changed files with 86 additions and 16 deletions
+1 -2
View File
@@ -200,7 +200,7 @@ const gracefulShutdown = (signal: string) => {
// 超时后强制退出
setTimeout(() => {
console.error("优雅关闭超时。强制退出。");
console.error("关闭超时。强制退出。");
process.exit(1);
}, 10000); // 10 秒超时
};
@@ -209,6 +209,5 @@ process.on('SIGINT', () => gracefulShutdown('SIGINT'));
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
process.on('SIGUSR2', () => {
// 优雅地处理 nodemon 重启
gracefulShutdown('SIGUSR2 (nodemon restart)');
});