@@ -91,8 +91,9 @@ export class IntegrationService implements Disposable {
9191 private async syncCloudIntegrations ( forceConnect : boolean ) {
9292 const scope = getLogScope ( ) ;
9393 const connectedIntegrations = new Set < IntegrationId > ( ) ;
94+ const domainsById = new Map < IntegrationId , string > ( ) ;
95+
9496 const loggedIn = await this . container . subscription . getAuthenticationSession ( ) ;
95- const domains = new Map < string , string > ( ) ;
9697 if ( loggedIn ) {
9798 const cloudIntegrations = await this . container . cloudIntegrations ;
9899 const connections = await cloudIntegrations ?. getConnections ( ) ;
@@ -106,15 +107,15 @@ export class IntegrationService implements Disposable {
106107 if ( p . domain ?. length > 0 ) {
107108 try {
108109 const host = new URL ( p . domain ) . host ;
109- domains . set ( integrationId , host ) ;
110+ domainsById . set ( integrationId , host ) ;
110111 } catch {
111112 Logger . warn ( `Invalid domain for ${ integrationId } integration: ${ p . domain } . Ignoring.` , scope ) ;
112113 }
113114 }
114115 } ) ;
115116 }
116117
117- for await ( const integration of this . getSupportedCloudIntegrations ( domains ) ) {
118+ for await ( const integration of this . getSupportedCloudIntegrations ( domainsById ) ) {
118119 await integration . syncCloudConnection (
119120 connectedIntegrations . has ( integration . id ) ? 'connected' : 'disconnected' ,
120121 forceConnect ,
@@ -132,9 +133,9 @@ export class IntegrationService implements Disposable {
132133 return connectedIntegrations ;
133134 }
134135
135- private async * getSupportedCloudIntegrations ( domains : Map < string , string > ) : AsyncIterable < Integration > {
136+ private async * getSupportedCloudIntegrations ( domainsById : Map < IntegrationId , string > ) : AsyncIterable < Integration > {
136137 for ( const id of getSupportedCloudIntegrationIds ( ) ) {
137- if ( id === SelfHostedIntegrationId . CloudGitHubEnterprise && ! domains . has ( id ) ) {
138+ if ( id === SelfHostedIntegrationId . CloudGitHubEnterprise && ! domainsById . has ( id ) ) {
138139 try {
139140 // Try getting whatever we have now because we will need to disconnect
140141 yield this . get ( id ) ;
@@ -143,7 +144,7 @@ export class IntegrationService implements Disposable {
143144 // because we probably haven't ever had an instance of this integration
144145 }
145146 } else {
146- yield this . get ( id , domains ? .get ( id ) ) ;
147+ yield this . get ( id , domainsById . get ( id ) ) ;
147148 }
148149 }
149150 }
@@ -594,11 +595,13 @@ export class IntegrationService implements Disposable {
594595 // case 'bitbucket':
595596 // return get(HostingIntegrationId.Bitbucket) as RT;
596597 case 'github' :
597- if ( remote . provider . custom && remote . provider . domain != null ) {
598- return get ( SelfHostedIntegrationId . GitHubEnterprise , remote . provider . domain ) as RT ;
599- }
600598 if ( remote . provider . domain != null && ! isGitHubDotCom ( remote . provider . domain ) ) {
601- return get ( SelfHostedIntegrationId . CloudGitHubEnterprise , remote . provider . domain ) as RT ;
599+ return get (
600+ remote . provider . custom
601+ ? SelfHostedIntegrationId . GitHubEnterprise
602+ : SelfHostedIntegrationId . CloudGitHubEnterprise ,
603+ remote . provider . domain ,
604+ ) as RT ;
602605 }
603606 return get ( HostingIntegrationId . GitHub ) as RT ;
604607 case 'gitlab' :
0 commit comments