Fix race condition in unregistering authentication providers (#250667)

A minimal change for endgame.
This commit is contained in:
Tyler James Leonhardt
2025-06-04 13:35:13 -07:00
committed by GitHub
parent 75ea5730cc
commit 89fbfc20ab
2 changed files with 7 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ export function activate(context: vscode.ExtensionContext) {
let before = vscode.workspace.getConfiguration().get<string>('github-enterprise.uri');
let githubEnterpriseAuthProvider = initGHES(context, uriHandler);
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(async e => {
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('github-enterprise.uri')) {
const after = vscode.workspace.getConfiguration().get<string>('github-enterprise.uri');
if (before !== after) {

View File

@@ -160,12 +160,17 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
return Promise.resolve();
}
// Today, this only handles unregistering extensions that have disposables...
// so basiscally just the dynmaic ones. This was done to fix a bug where
// there was a racecondition between this event and re-registering a provider
// with the same id. (https://github.com/microsoft/vscode-copilot/issues/18045)
// This works for now, but should be cleaned up so theres one flow for register/unregister
$onDidUnregisterAuthenticationProvider(id: string): Promise<void> {
const providerData = this._authenticationProviders.get(id);
if (providerData?.disposable) {
providerData.disposable.dispose();
this._authenticationProviders.delete(id);
}
this._authenticationProviders.delete(id);
return Promise.resolve();
}