Skip to content

Conversation

@bwateratmsft
Copy link
Contributor

@bwateratmsft bwateratmsft commented Oct 28, 2025

Same as #2110 but a better fix.

This is an easier way to understand what's happened, because it skips the added/reverted #2110:
27e1388...ece2793

@bwateratmsft bwateratmsft requested a review from a team as a code owner October 28, 2025 17:40
@bwateratmsft bwateratmsft requested review from Copilot and removed request for Copilot October 28, 2025 19:43
@bwateratmsft
Copy link
Contributor Author

@copilot can you review this?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the event handling mechanism in VSCodeAzureSubscriptionProvider to improve concurrency safety and prevent infinite event loops. The changes implement a lazy listener pattern and add proper synchronization for account state checking.

  • Introduces event emitters for sign-in/sign-out events with lazy listener initialization
  • Adds promise-based synchronization to prevent race conditions in accountsRemoved()
  • Consolidates duplicate event suppression flags into a single suppressEvents variable

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
auth/src/VSCodeAzureSubscriptionProvider.ts Refactored event handling with lazy listener initialization, added concurrency-safe accountsRemoved() method, and consolidated event suppression logic
auth/package.json Bumped version from 5.1.0 to 5.1.1
auth/package-lock.json Updated lockfile to reflect new version
auth/CHANGELOG.md Added release notes for version 5.1.1
Files not reviewed (1)
  • auth/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Oct 28, 2025

@bwateratmsft I've opened a new pull request, #2112, to work on those changes. Once the pull request is ready, I'll request review from you.

Comment on lines +32 to +33
private lastEventFired: number = 0;
private suppressEvents: boolean = false;
Copy link
Contributor Author

@bwateratmsft bwateratmsft Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up having to combine the timers/suppression. I can't make it work with two separate debounce timers--there's always some way things go wrong. However, I think it's fine--it's not likely the user is simultaneously signing in and signing out.

@bwateratmsft bwateratmsft merged commit dfc2bba into main Oct 28, 2025
10 checks passed
@bwateratmsft bwateratmsft deleted the bmw/betterFix branch October 28, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants