🔌 fix: Prevent Repeated Idle Check Triggers for Users With Failed MCP Connections (#12853)

This commit is contained in:
David Newman 2026-04-28 20:19:35 -04:00 • committed by GitHub
parent 2503365c44
commit 1f37ec842a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -268,10 +268,16 @@ export abstract class UserConnectionManager {
this.pendingConnections.delete(key);
}
}
// Ensure user activity timestamp is removed
this.userLastActivity.delete(userId);
logger.info(`[MCP][User: ${userId}] All connections processed for disconnection.`);
}
/**
* Always clear the activity timestamp, even when userMap was missing.
* `updateUserLastActivity` can be called before a connection is established
* (e.g. in MCPManager.callTool prior to getConnection); if that connection
* attempt fails, the activity entry would otherwise leak and trigger the
* idle check repeatedly for the same userId.
*/
this.userLastActivity.delete(userId);
}
/** Check for and disconnect idle connections */