Skip to content

Commit

Permalink
fix(updates): Check immediately for updates, and then not for 5 mins
Browse files Browse the repository at this point in the history
  • Loading branch information
castaway committed Feb 19, 2025
1 parent 8d4a12e commit 09068cb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/app/updatealert/updatealert.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ export class UpdateAlertService {
dialog.open(UpdateAlertComponent, { data: ev });
});

this.checkForUpdates();
this.ngZone.runOutsideAngular(() => {
this.checkForUpdates();
setTimeout(() => this.ngZone.run(() =>
this.checkForUpdates()
), 5 * 60 * 1000);
});
}
}

checkForUpdates() {
// Check for updates every minute
this.ngZone.runOutsideAngular(() =>
setTimeout(() => this.ngZone.run(() => {
console.log(' checking for updates');
this.swupdate.checkForUpdate()
.then(() => this.checkForUpdates())
.catch((err) => console.log('Unable to check for updates', err));
}), 60 * 1000)
);
console.log(' checking for updates');
this.swupdate.checkForUpdate()
.then(() => this.checkForUpdates())
.catch((err) => console.log('Unable to check for updates', err));
}
}

0 comments on commit 09068cb

Please sign in to comment.