From 2f092e1c57b46b2c997fdd861529560e959d78c6 Mon Sep 17 00:00:00 2001 From: hkobew Date: Fri, 15 Nov 2024 17:41:58 -0500 Subject: [PATCH] avoid adding test session to session tracker --- packages/core/src/awsService/ec2/model.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/awsService/ec2/model.ts b/packages/core/src/awsService/ec2/model.ts index 46b0c1dbf44..5280d951d56 100644 --- a/packages/core/src/awsService/ec2/model.ts +++ b/packages/core/src/awsService/ec2/model.ts @@ -198,9 +198,8 @@ export class Ec2Connecter implements vscode.Disposable { const remoteUser = await this.getRemoteUser(selection.instanceId) const remoteEnv = await this.prepareEc2RemoteEnvWithProgress(selection, remoteUser) - + const testSession = await this.ssmClient.startSession(selection.instanceId, 'AWS-StartSSHSession') try { - const testSession = await this.startSSMSession(selection.instanceId) await testSshConnection( remoteEnv.SessionProcess, remoteEnv.hostname, @@ -211,6 +210,8 @@ export class Ec2Connecter implements vscode.Disposable { await startVscodeRemote(remoteEnv.SessionProcess, remoteEnv.hostname, '/', remoteEnv.vscPath, remoteUser) } catch (err) { this.throwGeneralConnectionError(selection, err as Error) + } finally { + await this.ssmClient.terminateSession(testSession) } }