Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2 Fixes/6975.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Delete the old session immediatly after session restart instead of on close
10 changes: 3 additions & 7 deletions src/client/datascience/jupyter/jupyterSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export class JupyterSession implements IJupyterSession {
private statusHandler: Slot<Session.ISession, Kernel.Status> | undefined;
private connected: boolean = false;
private jupyterPasswordConnect: IJupyterPasswordConnect;
private oldSessions: Session.ISession[] = [];

constructor(
connInfo: IConnection,
Expand Down Expand Up @@ -124,8 +123,8 @@ export class JupyterSession implements IJupyterSession {
if (oldStatusHandler) {
oldSession.statusChanged.disconnect(oldStatusHandler);
}
// Don't shutdown old sessions yet. This seems to hang tests.
this.oldSessions.push(oldSession);

this.shutdownSession(oldSession, undefined).ignoreErrors();
} else {
throw new Error(localize.DataScience.sessionDisposed());
}
Expand Down Expand Up @@ -207,8 +206,7 @@ export class JupyterSession implements IJupyterSession {
traceInfo(`Error waiting for restart session: ${exc}`);
tryCount += 1;
if (result) {
// Cleanup later.
this.oldSessions.push(result);
this.shutdownSession(result, undefined).ignoreErrors();
}
result = undefined;
exception = exc;
Expand Down Expand Up @@ -375,8 +373,6 @@ export class JupyterSession implements IJupyterSession {
}
if (this.session || this.sessionManager) {
try {
traceInfo('ShutdownSessionAndConnection - old sessions');
await Promise.all(this.oldSessions.map(s => this.shutdownSession(s, undefined)));
traceInfo('ShutdownSessionAndConnection - current session');
await this.shutdownSession(this.session, this.statusHandler);
traceInfo('ShutdownSessionAndConnection - get restart session');
Expand Down