mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 22:32:27 +08:00
fix(mcp-server): add graceful shutdown to prevent zombie processes (#477)
* fix(mcp-server): add graceful shutdown to prevent zombie processes Add lifecycle handlers to properly exit the MCP server when the parent application closes: - Listen for stdin close/end events (primary method for all platforms) - Handle SIGINT/SIGTERM signals - Handle stdout broken pipe errors - Export shutdown() function from http-server to clean up resources * chore(mcp-server): bump version to 0.1.11
This commit is contained in:
@@ -127,7 +127,12 @@ function cleanupExpiredSessions(): void {
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(cleanupExpiredSessions, 5 * 60 * 1000)
|
||||
const cleanupIntervalId = setInterval(cleanupExpiredSessions, 5 * 60 * 1000)
|
||||
|
||||
export function shutdown(): void {
|
||||
clearInterval(cleanupIntervalId)
|
||||
stopHttpServer()
|
||||
}
|
||||
|
||||
export function getServerPort(): number {
|
||||
return serverPort
|
||||
|
||||
Reference in New Issue
Block a user