mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
* Fixed #4384 add await on disconnect * Resolve PR comment
This commit is contained in:
@@ -712,11 +712,11 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
|||||||
if (this.notebookOptions && this.notebookOptions.connectionService) {
|
if (this.notebookOptions && this.notebookOptions.connectionService) {
|
||||||
let connectionService = this.notebookOptions.connectionService;
|
let connectionService = this.notebookOptions.connectionService;
|
||||||
if (this._otherConnections) {
|
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 = [];
|
this._otherConnections = [];
|
||||||
}
|
}
|
||||||
if (this._activeConnection) {
|
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;
|
this._activeConnection = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export function getProvidersForFileName(fileName: string, notebookService: INote
|
|||||||
return providers;
|
return providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getStandardKernelsForProvider(providerId: string, notebookService: INotebookService) : IStandardKernelWithProvider[] {
|
export function getStandardKernelsForProvider(providerId: string, notebookService: INotebookService): IStandardKernelWithProvider[] {
|
||||||
if (!providerId || !notebookService) {
|
if (!providerId || !notebookService) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ export function getServerFromFormattedAttachToName(name: string): string {
|
|||||||
// Extract database name from format used in Attach To: serverName (databaseName)
|
// Extract database name from format used in Attach To: serverName (databaseName)
|
||||||
export function getDatabaseFromFormattedAttachToName(name: string): string {
|
export function getDatabaseFromFormattedAttachToName(name: string): string {
|
||||||
return name.substring(name.lastIndexOf('(') + 1, name.lastIndexOf(')')) ?
|
return name.substring(name.lastIndexOf('(') + 1, name.lastIndexOf(')')) ?
|
||||||
name.substring(name.lastIndexOf('(') + 1, name.lastIndexOf(')')) : '';
|
name.substring(name.lastIndexOf('(') + 1, name.lastIndexOf(')')) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IStandardKernelWithProvider {
|
export interface IStandardKernelWithProvider {
|
||||||
@@ -117,3 +117,9 @@ export function tryMatchCellMagic(input: string): string {
|
|||||||
let magicName = match && match[1];
|
let magicName = match && match[1];
|
||||||
return magicName;
|
return magicName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function asyncForEach(array: any, callback: any): Promise<any> {
|
||||||
|
for (let index = 0; index < array.length; index++) {
|
||||||
|
await callback(array[index], index, array);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user