mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-13 14:10:59 +00: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(() => {
|
useEffect(() => {
|
||||||
const hasConnecting = installedServers.some(
|
const hasConnecting = installedServers.some(
|
||||||
(server) => server.status === MCPSessionStatus.CONNECTING,
|
(server) =>
|
||||||
|
server.enable && server.status === MCPSessionStatus.CONNECTING,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hasConnecting && !pollingIntervalRef.current) {
|
if (hasConnecting && !pollingIntervalRef.current) {
|
||||||
@@ -42,7 +43,7 @@ export default function MCPComponent({
|
|||||||
fetchInstalledServers();
|
fetchInstalledServers();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
} else if (!hasConnecting && pollingIntervalRef.current) {
|
} else if (!hasConnecting && pollingIntervalRef.current) {
|
||||||
// Stop polling when no server is connecting
|
// Stop polling when no enabled server is connecting
|
||||||
clearInterval(pollingIntervalRef.current);
|
clearInterval(pollingIntervalRef.current);
|
||||||
pollingIntervalRef.current = null;
|
pollingIntervalRef.current = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user