fix: add disposed guard to MCP manager and guard unregister on pending connections

This commit is contained in:
YeonGyu-Kim
2026-03-12 00:51:02 +09:00
parent f564404015
commit aa1aad3bb1
6 changed files with 11 additions and 2 deletions
+3 -2
View File
@@ -81,7 +81,7 @@ async function cleanupIdleClients(state: SkillMcpManagerState): Promise<void> {
}
}
if (state.clients.size === 0) {
if (state.clients.size === 0 && state.pendingConnections.size === 0) {
stopCleanupTimer(state)
unregisterProcessCleanup(state)
}
@@ -119,7 +119,7 @@ export async function disconnectSession(state: SkillMcpManagerState, sessionID:
state.pendingConnections.delete(key)
}
if (state.clients.size === 0) {
if (state.clients.size === 0 && state.pendingConnections.size === 0) {
stopCleanupTimer(state)
unregisterProcessCleanup(state)
}
@@ -127,6 +127,7 @@ export async function disconnectSession(state: SkillMcpManagerState, sessionID:
export async function disconnectAll(state: SkillMcpManagerState): Promise<void> {
state.shutdownGeneration++
state.disposed = true
stopCleanupTimer(state)
unregisterProcessCleanup(state)