updater: async'ify

This commit is contained in:
Girish Ramakrishnan
2021-08-31 13:12:14 -07:00
parent d225a687a5
commit b5d6588e3e
3 changed files with 73 additions and 96 deletions
+4 -2
View File
@@ -190,14 +190,16 @@ function autoupdatePatternChanged(pattern, tz) {
// do box before app updates. for the off chance that the box logic fixes some app update logic issue
if (updateInfo.box && !updateInfo.box.unstable) {
debug('Starting box autoupdate to %j', updateInfo.box);
await safe(updater.updateToLatest({ skipBackup: false }, auditSource.CRON));
const [error] = await safe(updater.updateToLatest({ skipBackup: false }, auditSource.CRON));
if (error) debug(`Failed to box autoupdate: ${error.message}`);
return;
}
const appUpdateInfo = _.omit(updateInfo, 'box');
if (Object.keys(appUpdateInfo).length > 0) {
debug('Starting app update to %j', appUpdateInfo);
await safe(apps.autoupdateApps(appUpdateInfo, auditSource.CRON));
const [error] = await safe(apps.autoupdateApps(appUpdateInfo, auditSource.CRON));
if (error) debug(`Failed to app autoupdate: ${error.message}`);
} else {
debug('No app auto updates available');
}