55import { ExtContext } from '../../shared/extensions'
66import { Commands } from '../../shared/vscode/commands2'
77import { telemetry } from '../../shared/telemetry/telemetry'
8- import { Ec2InstanceNode , refreshExplorerNode } from './explorer/ec2InstanceNode'
8+ import { Ec2InstanceNode , tryRefreshNode } from './explorer/ec2InstanceNode'
99import { copyTextCommand } from '../../awsexplorer/commands/copyText'
1010import { Ec2Node } from './explorer/ec2ParentNode'
11- import { Ec2ConnectionManager } from './model'
1211
13- export type Ec2ConnectionManagerMap = Map < string , Ec2ConnectionManager >
14-
15- const connectionManagers = new Map < string , Ec2ConnectionManager > ( )
12+ const connectionManagers = new Ec2ConnectionManagerMap ( )
1613import {
1714 openRemoteConnection ,
1815 openTerminal ,
@@ -21,6 +18,7 @@ import {
2118 stopInstance ,
2219 linkToLaunchInstance ,
2320} from './commands'
21+ import { Ec2ConnectionManagerMap } from './connectionManagerMap'
2422
2523export async function activate ( ctx : ExtContext ) : Promise < void > {
2624 ctx . extensionContext . subscriptions . push (
@@ -43,23 +41,23 @@ export async function activate(ctx: ExtContext): Promise<void> {
4341 await telemetry . ec2_changeState . run ( async ( span ) => {
4442 span . record ( { ec2InstanceState : 'start' } )
4543 await startInstance ( node )
46- await refreshExplorerNode ( node )
44+ await tryRefreshNode ( node )
4745 } )
4846 } ) ,
4947
5048 Commands . register ( 'aws.ec2.stopInstance' , async ( node ?: Ec2Node ) => {
5149 await telemetry . ec2_changeState . run ( async ( span ) => {
5250 span . record ( { ec2InstanceState : 'stop' } )
5351 await stopInstance ( node )
54- await refreshExplorerNode ( node )
52+ await tryRefreshNode ( node )
5553 } )
5654 } ) ,
5755
5856 Commands . register ( 'aws.ec2.rebootInstance' , async ( node ?: Ec2Node ) => {
5957 await telemetry . ec2_changeState . run ( async ( span ) => {
6058 span . record ( { ec2InstanceState : 'reboot' } )
6159 await rebootInstance ( node )
62- await refreshExplorerNode ( node )
60+ await tryRefreshNode ( node )
6361 } )
6462 } ) ,
6563
@@ -72,5 +70,5 @@ export async function activate(ctx: ExtContext): Promise<void> {
7270}
7371
7472export async function deactivate ( ) : Promise < void > {
75- connectionManagers . forEach ( async ( manager ) => await manager . closeConnections ( ) )
73+ connectionManagers . forEach ( async ( manager ) => await manager . dispose ( ) )
7674}
0 commit comments