Fixed #4384 add await on disconnect (#4389)

* Fixed #4384 add await on disconnect

* Resolve PR comment
This commit is contained in:
Yurong He
2019-03-12 13:06:02 -07:00
committed by GitHub
parent d555dcb6d7
commit 08c7cc0918
2 changed files with 10 additions and 4 deletions

View File

@@ -712,11 +712,11 @@ export class NotebookModel extends Disposable implements INotebookModel {
if (this.notebookOptions && this.notebookOptions.connectionService) {
let connectionService = this.notebookOptions.connectionService;
if (this._otherConnections) {
this._otherConnections.forEach(conn => connectionService.disconnect(conn).catch(e => console.log(e)));
notebookUtils.asyncForEach(this._otherConnections, async (conn) => await connectionService.disconnect(conn).catch(e => console.log(e)));
this._otherConnections = [];
}
if (this._activeConnection) {
this.notebookOptions.connectionService.disconnect(this._activeConnection).catch(e => console.log(e));
await this.notebookOptions.connectionService.disconnect(this._activeConnection).catch(e => console.log(e));
this._activeConnection = undefined;
}
}