@@ -46,7 +46,6 @@ export class JupyterSession implements IJupyterSession {
46
46
private statusHandler : Slot < Session . ISession , Kernel . Status > | undefined ;
47
47
private connected : boolean = false ;
48
48
private jupyterPasswordConnect : IJupyterPasswordConnect ;
49
- private oldSessions : Session . ISession [ ] = [ ] ;
50
49
51
50
constructor (
52
51
connInfo : IConnection ,
@@ -124,8 +123,8 @@ export class JupyterSession implements IJupyterSession {
124
123
if ( oldStatusHandler ) {
125
124
oldSession . statusChanged . disconnect ( oldStatusHandler ) ;
126
125
}
127
- // Don't shutdown old sessions yet. This seems to hang tests.
128
- this . oldSessions . push ( oldSession ) ;
126
+
127
+ this . shutdownSession ( oldSession , undefined ) . ignoreErrors ( ) ;
129
128
} else {
130
129
throw new Error ( localize . DataScience . sessionDisposed ( ) ) ;
131
130
}
@@ -207,8 +206,7 @@ export class JupyterSession implements IJupyterSession {
207
206
traceInfo ( `Error waiting for restart session: ${ exc } ` ) ;
208
207
tryCount += 1 ;
209
208
if ( result ) {
210
- // Cleanup later.
211
- this . oldSessions . push ( result ) ;
209
+ this . shutdownSession ( result , undefined ) . ignoreErrors ( ) ;
212
210
}
213
211
result = undefined ;
214
212
exception = exc ;
@@ -375,8 +373,6 @@ export class JupyterSession implements IJupyterSession {
375
373
}
376
374
if ( this . session || this . sessionManager ) {
377
375
try {
378
- traceInfo ( 'ShutdownSessionAndConnection - old sessions' ) ;
379
- await Promise . all ( this . oldSessions . map ( s => this . shutdownSession ( s , undefined ) ) ) ;
380
376
traceInfo ( 'ShutdownSessionAndConnection - current session' ) ;
381
377
await this . shutdownSession ( this . session , this . statusHandler ) ;
382
378
traceInfo ( 'ShutdownSessionAndConnection - get restart session' ) ;
0 commit comments