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:
Charles Gagnon
2019-09-18 11:41:37 -07:00
committed by GitHub
parent 86a9a2c069
commit 373828d76f
3 changed files with 4 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ export class SqlToolsServer {
let clientOptions = getClientOptions(context);
this.client = new SqlOpsDataClient(Constants.serviceName, serverOptions, clientOptions);
const processStart = Date.now();
this.client.onReady().then(() => {
const clientReadyPromise = this.client.onReady().then(() => {
const processEnd = Date.now();
statusView.text = localize('serviceStartedStatusMsg', "{0} Started", Constants.serviceName);
setTimeout(() => {
@@ -59,7 +59,7 @@ export class SqlToolsServer {
statusView.show();
statusView.text = localize('startingServiceStatusMsg', "Starting {0}", Constants.serviceName);
this.client.start();
await this.activateFeatures(context);
await Promise.all([this.activateFeatures(context), clientReadyPromise]);
return this.client;
} catch (e) {
Telemetry.sendTelemetryEvent('ServiceInitializingFailed');