mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 03:15:06 +08:00
perf: only check connecting mcp server when it's enabled
This commit is contained in:
@@ -30,10 +30,11 @@ export default function MCPComponent({
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Check if any server is connecting and start/stop polling accordingly
|
||||
// Check if any enabled server is connecting and start/stop polling accordingly
|
||||
useEffect(() => {
|
||||
const hasConnecting = installedServers.some(
|
||||
(server) => server.status === MCPSessionStatus.CONNECTING,
|
||||
(server) =>
|
||||
server.enable && server.status === MCPSessionStatus.CONNECTING,
|
||||
);
|
||||
|
||||
if (hasConnecting && !pollingIntervalRef.current) {
|
||||
@@ -42,7 +43,7 @@ export default function MCPComponent({
|
||||
fetchInstalledServers();
|
||||
}, 3000);
|
||||
} else if (!hasConnecting && pollingIntervalRef.current) {
|
||||
// Stop polling when no server is connecting
|
||||
// Stop polling when no enabled server is connecting
|
||||
clearInterval(pollingIntervalRef.current);
|
||||
pollingIntervalRef.current = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user