mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-13 03:58:14 +00:00
Added thread-safe initialization to the McpServerManager singleton pattern to prevent potential race conditions when getInstance is called concurrently. The changes include: 1. Added initializationPromise to track ongoing initialization 2. Implemented double-checked locking pattern: - First check: Return existing instance if available - Second check: Wait for any ongoing initialization - Third check: Double-check inside initialization block 3. Added proper cleanup in finally block to prevent deadlocks This ensures that: - Only one McpHub instance is ever created - Concurrent calls wait for initialization to complete - Resources are properly initialized and cleaned up - No memory leaks from incomplete initialization The fix maintains the existing functionality while making it safe for concurrent access in VS Code's multi-window environment. |
||
|---|---|---|
| .. | ||
| __mocks__ | ||
| activate | ||
| api | ||
| core | ||
| exports | ||
| integrations | ||
| services | ||
| shared | ||
| test | ||
| utils | ||
| extension.ts | ||