From dd0f58d421664e9f82c399747dbc8e8a8c55e0ff Mon Sep 17 00:00:00 2001 From: Isaac Grynsztein Date: Thu, 9 Apr 2020 01:36:46 -0400 Subject: [PATCH] Fixed bug where updater kept asking for updates on the update after it completed --- .../update-progress-dialog.component.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts b/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts index a69bdac..fe1fbf4 100644 --- a/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts +++ b/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts @@ -18,19 +18,17 @@ export class UpdateProgressDialogComponent implements OnInit { ngOnInit(): void { this.getUpdateProgress(); setInterval(() => { - this.getUpdateProgress(); + if (this.updateStatus['updating']) { this.getUpdateProgress(); } }, 250); } getUpdateProgress() { this.postsService.getUpdaterStatus().subscribe(res => { - this.updateStatus = res; - if (!this.updateStatus) { - // update complete? - console.log('Update complete? or not started'); - } - if (this.updateStatus && this.updateStatus['error']) { - this.openSnackBar('Update failed. Check logs for more details.'); + if (res) { + this.updateStatus = res; + if (this.updateStatus && this.updateStatus['error']) { + this.openSnackBar('Update failed. Check logs for more details.'); + } } }); }