@@ -46,7 +46,6 @@ export class JupyterSession implements IJupyterSession {
4646 private statusHandler : Slot < Session . ISession , Kernel . Status > | undefined ;
4747 private connected : boolean = false ;
4848 private jupyterPasswordConnect : IJupyterPasswordConnect ;
49- private oldSessions : Session . ISession [ ] = [ ] ;
5049
5150 constructor (
5251 connInfo : IConnection ,
@@ -124,8 +123,8 @@ export class JupyterSession implements IJupyterSession {
124123 if ( oldStatusHandler ) {
125124 oldSession . statusChanged . disconnect ( oldStatusHandler ) ;
126125 }
127- // Don't shutdown old sessions yet. This seems to hang tests.
128- this . oldSessions . push ( oldSession ) ;
126+
127+ this . shutdownSession ( oldSession , undefined ) . ignoreErrors ( ) ;
129128 } else {
130129 throw new Error ( localize . DataScience . sessionDisposed ( ) ) ;
131130 }
@@ -207,8 +206,7 @@ export class JupyterSession implements IJupyterSession {
207206 traceInfo ( `Error waiting for restart session: ${ exc } ` ) ;
208207 tryCount += 1 ;
209208 if ( result ) {
210- // Cleanup later.
211- this . oldSessions . push ( result ) ;
209+ this . shutdownSession ( result , undefined ) . ignoreErrors ( ) ;
212210 }
213211 result = undefined ;
214212 exception = exc ;
@@ -375,8 +373,6 @@ export class JupyterSession implements IJupyterSession {
375373 }
376374 if ( this . session || this . sessionManager ) {
377375 try {
378- traceInfo ( 'ShutdownSessionAndConnection - old sessions' ) ;
379- await Promise . all ( this . oldSessions . map ( s => this . shutdownSession ( s , undefined ) ) ) ;
380376 traceInfo ( 'ShutdownSessionAndConnection - current session' ) ;
381377 await this . shutdownSession ( this . session , this . statusHandler ) ;
382378 traceInfo ( 'ShutdownSessionAndConnection - get restart session' ) ;
0 commit comments