Optimize auth record export.#1267
Conversation
scottaddie
left a comment
There was a problem hiding this comment.
Has this change been tested in both the client app and the /azure web experience?
client app yes. |
|
@g2vinay testing on /azure I didn't see the ~/.azure/authRecord.json file. But I didn't see it before I installed it either. Is it not working currently on /azure? |
It worked for me, did Resources actually activate? |
I made sure to load the tree view. I'll try again |
Oh BTW the path is in |
Yup, found it now. It's working as intented |
bwateratmsft
left a comment
There was a problem hiding this comment.
Ok, unfortunately it is still happening in /azure, just more quietly. Calling vscode.authentication.getAccounts() is enough to trigger vscode.authentication.onDidChangeSessions, so we need to work something else out.
We can consider, disabling this for VS code web as an alternative option. |
Sounds fine to me |
|
Sounds good, let's plan on doing that for now. When we reenable it, we should address #1226 too. @alexweininger what's the best way to detect if it's /azure? |
Cloud Shell folks have instructed me to look for the |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces AuthAccountStateManager to optimize authentication record exports by tracking account state changes and preventing unnecessary API calls. The optimization focuses on detecting meaningful changes (account additions/removals) to avoid processing token refreshes and session updates.
Key Changes:
- Introduced singleton
AuthAccountStateManagerclass with thread-safe concurrent request handling - Modified
exportAuthRecordto use state manager and only process meaningful account changes - Updated
getAuthenticationSessionto use cached accounts instead of fetching fresh data
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/exportAuthRecord.ts | Implements AuthAccountStateManager singleton class and refactors exportAuthRecord to use change detection logic |
| test/authAccountStateManager.test.ts | Adds comprehensive test suite for AuthAccountStateManager functionality |
| extension.bundle.ts | Exports AuthAccountStateManager and getAuthAccountStateManager for testing purposes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR introduces account state management to optimize authentication record exports by only processing meaningful account changes (additions/removals) while maintaining thread-safety.
Benefits