* Negative-cache a discovery failure. OAuth-required errors are exempt so * reconnects retry immediately.
(
workspaceId: string,
serverId: string,
error: unknown
)
| 385 | * reconnects retry immediately. |
| 386 | */ |
| 387 | private async markServerUnhealthy( |
| 388 | workspaceId: string, |
| 389 | serverId: string, |
| 390 | error: unknown |
| 391 | ): Promise<void> { |
| 392 | if (error instanceof McpOauthAuthorizationRequiredError || error instanceof UnauthorizedError) { |
| 393 | return |
| 394 | } |
| 395 | try { |
| 396 | await this.cacheAdapter.set( |
| 397 | failureCacheKey(workspaceId, serverId), |
| 398 | FAILURE_CACHE_SENTINEL, |
| 399 | MCP_CLIENT_CONSTANTS.FAILURE_CACHE_TTL_MS |
| 400 | ) |
| 401 | } catch (err) { |
| 402 | logger.warn(`Failed to write failure cache for server ${serverId}:`, err) |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | private async isServerUnhealthy(workspaceId: string, serverId: string): Promise<boolean> { |
| 407 | try { |
no test coverage detected