Fix #406: Prevent multiple server sessions at startup - #408
Conversation
|
Sorry for nor reviewing this sooner KC. I think a more simple solution is to create sessions for all current workspace folders on activation. If we do it before activation completes then we know that all intellisense requests will be using cookies since those requests won't be sent until after activation. We can add a code block here that is similar to the the one from the main extension. The we won't need to modify any other code. |
Per review feedback on intersystems#408: rather than serializing REST requests via a promise-based cookie cache, establish one session per workspace folder during activation, before it completes. IntelliSense requests aren't sent until after activation finishes, so they all reuse these sessions instead of each creating a new one when many editor tabs are open at startup (intersystems#406). Reverts the queueing changes to makeRESTRequest.ts and extracts the spec resolution logic into a reusable helper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per Brett's review of intersystems#408: rather than serializing REST requests via a promise-based cookie cache, create a session for each workspace folder during activation, before it completes. IntelliSense requests aren't sent until after activation finishes, so they all reuse these sessions instead of each creating a new one when many editor tabs are open at startup (intersystems#406). The resolveFromUri handler body is extracted into a resolveServerSpec helper so the activation loop can reuse it; no other code is modified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Thanks for the guidance. Please check the latest diff. |
Problem
When VS Code opens with many tabs, each tab concurrently calls
makeRESTRequest(), creating multiple sessions to the same server.Solution
Serialize REST requests per server using promise-based queueing:
Changes
cookiesCacheto store promises instead of raw cookie arraysgetCookies()/updateCookies()async with queue logicupdateCookies()in catch block to ensure promises always resolve