From 1a6202a3752509ff848e45463cc34c4df410691b Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Thu, 29 Aug 2019 16:23:21 -0700 Subject: [PATCH 1/2] close restart session right away --- news/2 Fixes/6975.md | 1 + src/client/datascience/jupyter/jupyterSession.ts | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) create mode 100644 news/2 Fixes/6975.md diff --git a/news/2 Fixes/6975.md b/news/2 Fixes/6975.md new file mode 100644 index 000000000000..a5e5fecc95f4 --- /dev/null +++ b/news/2 Fixes/6975.md @@ -0,0 +1 @@ +Delete the old session immediatly after session restart instead of on close \ No newline at end of file diff --git a/src/client/datascience/jupyter/jupyterSession.ts b/src/client/datascience/jupyter/jupyterSession.ts index 515739ed95df..5754b6a9bdef 100644 --- a/src/client/datascience/jupyter/jupyterSession.ts +++ b/src/client/datascience/jupyter/jupyterSession.ts @@ -46,7 +46,6 @@ export class JupyterSession implements IJupyterSession { private statusHandler: Slot | undefined; private connected: boolean = false; private jupyterPasswordConnect: IJupyterPasswordConnect; - private oldSessions: Session.ISession[] = []; constructor( connInfo: IConnection, @@ -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); } else { throw new Error(localize.DataScience.sessionDisposed()); } @@ -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); } result = undefined; exception = exc; @@ -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'); From 277d90430ed07490a7282b08c23bdf6688d3092b Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Thu, 29 Aug 2019 16:44:04 -0700 Subject: [PATCH 2/2] ignore errors on await, don't want to stop and wait for shutdown --- src/client/datascience/jupyter/jupyterSession.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/datascience/jupyter/jupyterSession.ts b/src/client/datascience/jupyter/jupyterSession.ts index 5754b6a9bdef..8ceba8e96534 100644 --- a/src/client/datascience/jupyter/jupyterSession.ts +++ b/src/client/datascience/jupyter/jupyterSession.ts @@ -124,7 +124,7 @@ export class JupyterSession implements IJupyterSession { oldSession.statusChanged.disconnect(oldStatusHandler); } - this.shutdownSession(oldSession, undefined); + this.shutdownSession(oldSession, undefined).ignoreErrors(); } else { throw new Error(localize.DataScience.sessionDisposed()); } @@ -206,7 +206,7 @@ export class JupyterSession implements IJupyterSession { traceInfo(`Error waiting for restart session: ${exc}`); tryCount += 1; if (result) { - this.shutdownSession(result, undefined); + this.shutdownSession(result, undefined).ignoreErrors(); } result = undefined; exception = exc;