mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Have MSSQL extension wait for SqlToolsService ready before finishing activation (#7087)
* Have mssql activate wait for service to be ready before returning * Change to using deferred promise * Await on server ready * Finish removing old code * More cleanup * Go back to exposed promise API * Make property readonly * Add missing file * Add back in deleted stuff * Go back to awaiting
This commit is contained in:
@@ -71,7 +71,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
|
|||||||
|
|
||||||
registerBooksWidget(bookContributionProvider);
|
registerBooksWidget(bookContributionProvider);
|
||||||
|
|
||||||
// initalize client last so we don't have features stuck behind it
|
// initialize client last so we don't have features stuck behind it
|
||||||
const server = new SqlToolsServer();
|
const server = new SqlToolsServer();
|
||||||
context.subscriptions.push(server);
|
context.subscriptions.push(server);
|
||||||
await server.start(appContext);
|
await server.start(appContext);
|
||||||
|
|||||||
@@ -27,6 +27,6 @@ export function createMssqlApi(context: AppContext): IExtension {
|
|||||||
return <any>oeProvider.findSqlClusterNodeByContext(explorerContext);
|
return <any>oeProvider.findSqlClusterNodeByContext(explorerContext);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class SqlToolsServer {
|
|||||||
let clientOptions = getClientOptions(context);
|
let clientOptions = getClientOptions(context);
|
||||||
this.client = new SqlOpsDataClient(Constants.serviceName, serverOptions, clientOptions);
|
this.client = new SqlOpsDataClient(Constants.serviceName, serverOptions, clientOptions);
|
||||||
const processStart = Date.now();
|
const processStart = Date.now();
|
||||||
this.client.onReady().then(() => {
|
const clientReadyPromise = this.client.onReady().then(() => {
|
||||||
const processEnd = Date.now();
|
const processEnd = Date.now();
|
||||||
statusView.text = localize('serviceStartedStatusMsg', "{0} Started", Constants.serviceName);
|
statusView.text = localize('serviceStartedStatusMsg', "{0} Started", Constants.serviceName);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -59,7 +59,7 @@ export class SqlToolsServer {
|
|||||||
statusView.show();
|
statusView.show();
|
||||||
statusView.text = localize('startingServiceStatusMsg', "Starting {0}", Constants.serviceName);
|
statusView.text = localize('startingServiceStatusMsg', "Starting {0}", Constants.serviceName);
|
||||||
this.client.start();
|
this.client.start();
|
||||||
await this.activateFeatures(context);
|
await Promise.all([this.activateFeatures(context), clientReadyPromise]);
|
||||||
return this.client;
|
return this.client;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Telemetry.sendTelemetryEvent('ServiceInitializingFailed');
|
Telemetry.sendTelemetryEvent('ServiceInitializingFailed');
|
||||||
|
|||||||
Reference in New Issue
Block a user