mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 09:35:40 -05:00
SQL-Migration extension - fix refresh reentrancy hang (#16482)
* Fix application hang on refresh * fix re-entrancy issue with refresh * adding additional refresh checking
This commit is contained in:
@@ -44,6 +44,8 @@ export class MigrationCutoverDialog {
|
||||
private _autoRefreshHandle!: any;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
private isRefreshing = false;
|
||||
|
||||
readonly _infoFieldWidth: string = '250px';
|
||||
|
||||
constructor(migration: MigrationContext) {
|
||||
@@ -279,8 +281,8 @@ export class MigrationCutoverDialog {
|
||||
d => { try { d.dispose(); } catch { } });
|
||||
}));
|
||||
|
||||
return view.initializeModel(form).then((value) => {
|
||||
this.refreshStatus();
|
||||
return view.initializeModel(form).then(async (value) => {
|
||||
await this.refreshStatus();
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@@ -493,13 +495,18 @@ export class MigrationCutoverDialog {
|
||||
const classVariable = this;
|
||||
clearInterval(this._autoRefreshHandle);
|
||||
if (interval !== -1) {
|
||||
this._autoRefreshHandle = setInterval(function () { classVariable.refreshStatus(); }, interval);
|
||||
this._autoRefreshHandle = setInterval(async function () { await classVariable.refreshStatus(); }, interval);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async refreshStatus(): Promise<void> {
|
||||
if (this.isRefreshing) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.isRefreshing = true;
|
||||
this._refreshLoader.loading = true;
|
||||
this._cutoverButton.enabled = false;
|
||||
this._cancelButton.enabled = false;
|
||||
@@ -615,8 +622,10 @@ export class MigrationCutoverDialog {
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
this.isRefreshing = false;
|
||||
this._refreshLoader.loading = false;
|
||||
}
|
||||
this._refreshLoader.loading = false;
|
||||
}
|
||||
|
||||
private createInfoField(label: string, value: string): {
|
||||
|
||||
Reference in New Issue
Block a user