Add acquireLoginSession API for Azdata (#13985)

* wip

* fix tests

* add tests

* PR comments
This commit is contained in:
Charles Gagnon
2021-01-20 10:35:26 -08:00
committed by GitHub
parent 9e9fac2991
commit 04dff9cdf2
16 changed files with 488 additions and 188 deletions

View File

@@ -71,10 +71,11 @@ export class MiaaModel extends ResourceModel {
return this._refreshPromise.promise;
}
this._refreshPromise = new Deferred();
let session: azdataExt.AzdataSession | undefined = undefined;
try {
await this.controllerModel.azdataLogin();
session = await this.controllerModel.acquireAzdataSession();
try {
const result = await this._azdataApi.azdata.arc.sql.mi.show(this.info.name);
const result = await this._azdataApi.azdata.arc.sql.mi.show(this.info.name, this.controllerModel.azdataAdditionalEnvVars, session);
this._config = result.result;
this.configLastUpdated = new Date();
this._onConfigUpdated.fire(this._config);
@@ -114,6 +115,7 @@ export class MiaaModel extends ResourceModel {
this._refreshPromise.reject(err);
throw err;
} finally {
session?.dispose();
this._refreshPromise = undefined;
}
}