Only when the connection is connected, then do disconnect. (#5170)

This commit is contained in:
Yurong He
2019-04-23 19:03:49 -07:00
committed by GitHub
parent 7d46e77922
commit e822091907

View File

@@ -329,7 +329,13 @@ class SqlKernel extends Disposable implements nb.IKernel {
public async disconnect(): Promise<void> {
if (this._path) {
await this._connectionManagementService.disconnect(this._path);
if (this._connectionManagementService.isConnected(this._path)) {
try {
await this._connectionManagementService.disconnect(this._path);
} catch (err) {
console.log(err);
}
}
}
return;
}