mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -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:
@@ -49,6 +49,8 @@ export class DashboardWidget {
|
||||
private _autoRefreshHandle!: NodeJS.Timeout;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
private isRefreshing: boolean = false;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
@@ -242,14 +244,19 @@ export class DashboardWidget {
|
||||
}
|
||||
|
||||
private setAutoRefresh(interval: SupportedAutoRefreshIntervals): void {
|
||||
let classVariable = this;
|
||||
const classVariable = this;
|
||||
clearInterval(this._autoRefreshHandle);
|
||||
if (interval !== -1) {
|
||||
this._autoRefreshHandle = setInterval(function () { classVariable.refreshMigrations(); }, interval);
|
||||
this._autoRefreshHandle = setInterval(async function () { await classVariable.refreshMigrations(); }, interval);
|
||||
}
|
||||
}
|
||||
|
||||
private async refreshMigrations(): Promise<void> {
|
||||
if (this.isRefreshing) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isRefreshing = true;
|
||||
this._viewAllMigrationsButton.enabled = false;
|
||||
this._migrationStatusCardLoadingContainer.loading = true;
|
||||
try {
|
||||
@@ -304,6 +311,7 @@ export class DashboardWidget {
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
this.isRefreshing = false;
|
||||
this._migrationStatusCardLoadingContainer.loading = false;
|
||||
this._viewAllMigrationsButton.enabled = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user