perf(McpHub/reloadMcpServers): ensure no multiple reloads are running, ensure one last update

This commit is contained in:
NamesMT 2025-05-22 12:44:16 +00:00
parent 22eb2743b7
commit 5d441dc3f2
3 changed files with 22 additions and 0 deletions

9
pnpm-lock.yaml generated
View file

@ -236,6 +236,9 @@ importers:
isbinaryfile: isbinaryfile:
specifier: ^5.0.2 specifier: ^5.0.2
version: 5.0.4 version: 5.0.4
kontroll:
specifier: ^1.0.5
version: 1.0.5
mammoth: mammoth:
specifier: ^1.8.0 specifier: ^1.8.0
version: 1.9.0 version: 1.9.0
@ -5881,6 +5884,10 @@ packages:
kolorist@1.8.0: kolorist@1.8.0:
resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==}
kontroll@1.0.5:
resolution: {integrity: sha512-Fc9SZ3JGGkSrOo8rIGoZMjhfaaXY0DvJaewSdKve2KuT98icylO2J130Zsb/7Hzm9BnQ+88avT0ka51A4qBGuQ==}
engines: {node: '>=18.0.0'}
langium@3.3.1: langium@3.3.1:
resolution: {integrity: sha512-QJv/h939gDpvT+9SiLVlY7tZC3xB2qK57v0J04Sh9wpMb6MP1q8gB21L3WIo8T5P1MSMg3Ep14L7KkDCFG3y4w==} resolution: {integrity: sha512-QJv/h939gDpvT+9SiLVlY7tZC3xB2qK57v0J04Sh9wpMb6MP1q8gB21L3WIo8T5P1MSMg3Ep14L7KkDCFG3y4w==}
engines: {node: '>=16.0.0'} engines: {node: '>=16.0.0'}
@ -15354,6 +15361,8 @@ snapshots:
kolorist@1.8.0: {} kolorist@1.8.0: {}
kontroll@1.0.5: {}
langium@3.3.1: langium@3.3.1:
dependencies: dependencies:
chevrotain: 11.0.3 chevrotain: 11.0.3

View file

@ -381,6 +381,7 @@
"i18next": "^24.2.2", "i18next": "^24.2.2",
"ignore": "^7.0.3", "ignore": "^7.0.3",
"isbinaryfile": "^5.0.2", "isbinaryfile": "^5.0.2",
"kontroll": "^1.0.5",
"mammoth": "^1.8.0", "mammoth": "^1.8.0",
"monaco-vscode-textmate-theme-converter": "^0.1.7", "monaco-vscode-textmate-theme-converter": "^0.1.7",
"node-cache": "^5.1.2", "node-cache": "^5.1.2",

View file

@ -17,6 +17,7 @@ import * as path from "path"
import * as vscode from "vscode" import * as vscode from "vscode"
import { z } from "zod" import { z } from "zod"
import { t } from "../../i18n" import { t } from "../../i18n"
import { countdown } from "kontroll"
import { ClineProvider } from "../../core/webview/ClineProvider" import { ClineProvider } from "../../core/webview/ClineProvider"
import { GlobalFileNames } from "../../shared/globalFileNames" import { GlobalFileNames } from "../../shared/globalFileNames"
@ -354,6 +355,17 @@ export class McpHub {
} }
public async reloadMcpServers() { public async reloadMcpServers() {
if (this.isConnecting) {
countdown(
2000,
() => {
this.reloadMcpServers()
},
{ key: "reloadMcpServers" },
)
return
}
await this.initializeProjectMcpServers() await this.initializeProjectMcpServers()
await this.initializeGlobalMcpServers() await this.initializeGlobalMcpServers()
} }