@@ -1233,13 +1233,13 @@ class ChatSetupController extends Disposable {
1233
1233
let session : AuthenticationSession | undefined ;
1234
1234
let entitlement : ChatEntitlement | undefined ;
1235
1235
1236
+ const installation = this . doInstall ( ) ;
1237
+
1236
1238
// Entitlement Unknown or `forceSignIn`: we need to sign-in user
1237
1239
if ( this . context . state . entitlement === ChatEntitlement . Unknown || options . forceSignIn ) {
1238
1240
this . setStep ( ChatSetupStep . SigningIn ) ;
1239
1241
const result = await this . signIn ( { useAlternateProvider : options . useAlternateProvider } ) ;
1240
1242
if ( ! result . session ) {
1241
- this . doInstall ( ) ; // still install the extension in the background to remind the user to sign-in eventually
1242
-
1243
1243
this . telemetryService . publicLog2 < InstallChatEvent , InstallChatClassification > ( 'commandCenter.chatInstall' , { installResult : 'failedNotSignedIn' , installDuration : watch . elapsed ( ) , signUpErrorCode : undefined } ) ;
1244
1244
return undefined ; // treat as cancelled because signing in already triggers an error dialog
1245
1245
}
@@ -1258,7 +1258,7 @@ class ChatSetupController extends Disposable {
1258
1258
1259
1259
// Install
1260
1260
this . setStep ( ChatSetupStep . Installing ) ;
1261
- success = await this . install ( session , entitlement ?? this . context . state . entitlement , providerId , watch ) ;
1261
+ success = await this . install ( session , entitlement ?? this . context . state . entitlement , providerId , watch , installation ) ;
1262
1262
} finally {
1263
1263
this . setStep ( ChatSetupStep . Initial ) ;
1264
1264
this . context . resume ( ) ;
@@ -1292,7 +1292,7 @@ class ChatSetupController extends Disposable {
1292
1292
return { session, entitlement : entitlements ?. entitlement } ;
1293
1293
}
1294
1294
1295
- private async install ( session : AuthenticationSession | undefined , entitlement : ChatEntitlement , providerId : string , watch : StopWatch ) : Promise < ChatSetupResultValue > {
1295
+ private async install ( session : AuthenticationSession | undefined , entitlement : ChatEntitlement , providerId : string , watch : StopWatch , installation : Promise < void > ) : Promise < ChatSetupResultValue > {
1296
1296
const wasRunning = this . context . state . installed && ! this . context . state . disabled ;
1297
1297
let signUpResult : boolean | { errorCode : number } | undefined = undefined ;
1298
1298
@@ -1323,7 +1323,7 @@ class ChatSetupController extends Disposable {
1323
1323
}
1324
1324
}
1325
1325
1326
- await this . doInstallWithRetry ( ) ;
1326
+ await this . doInstallWithRetry ( installation ) ;
1327
1327
} catch ( error ) {
1328
1328
this . logService . error ( `[chat setup] install: error ${ error } ` ) ;
1329
1329
this . telemetryService . publicLog2 < InstallChatEvent , InstallChatClassification > ( 'commandCenter.chatInstall' , { installResult : isCancellationError ( error ) ? 'cancelled' : 'failedInstall' , installDuration : watch . elapsed ( ) , signUpErrorCode : undefined } ) ;
@@ -1341,10 +1341,10 @@ class ChatSetupController extends Disposable {
1341
1341
return true ;
1342
1342
}
1343
1343
1344
- private async doInstallWithRetry ( ) : Promise < void > {
1344
+ private async doInstallWithRetry ( installation : Promise < void > ) : Promise < void > {
1345
1345
let error : Error | undefined ;
1346
1346
try {
1347
- await this . doInstall ( ) ;
1347
+ await installation ;
1348
1348
} catch ( e ) {
1349
1349
this . logService . error ( `[chat setup] install: error ${ error } ` ) ;
1350
1350
error = e ;
@@ -1360,7 +1360,7 @@ class ChatSetupController extends Disposable {
1360
1360
} ) ;
1361
1361
1362
1362
if ( confirmed ) {
1363
- return this . doInstallWithRetry ( ) ;
1363
+ return this . doInstallWithRetry ( this . doInstall ( ) ) ;
1364
1364
}
1365
1365
}
1366
1366
0 commit comments