notify failed backups

fixes #649
This commit is contained in:
Girish Ramakrishnan
2019-10-11 19:35:21 -07:00
parent bd3080a6b3
commit eb5c2ed30b
3 changed files with 9 additions and 6 deletions
+5 -3
View File
@@ -294,7 +294,7 @@ function backupFailed(eventId, taskId, errorMessage, callback) {
actionForAllAdmins([], function (admin, callback) {
mailer.backupFailed(admin.email, errorMessage, `${settings.adminOrigin()}/logs.html?taskId=${taskId}`);
add(admin.id, eventId, 'Failed to backup', `Backup failed: ${errorMessage}. Logs are available [here](/logs.html?taskId=${taskId}). Will be retried in 4 hours`, callback);
add(admin.id, eventId, 'Backup failed', `Backup failed: ${errorMessage}. Logs are available [here](/logs.html?taskId=${taskId}). Will be retried in 4 hours`, callback);
}, callback);
}
@@ -379,8 +379,10 @@ function onEvent(id, action, source, data, callback) {
return certificateRenewalError(id, data.domain, data.errorMessage, callback);
case eventlog.ACTION_BACKUP_FINISH:
if (!data.errorMessage || source.username !== 'cron') return callback();
return backupFailed(id, data.taskId, data.errorMessage, callback); // only notify for automated backups
if (!data.errorMessage) return callback();
if (source.username !== auditSource.CRON.username && !data.timedOut) return callback(); // manual stop by user
return backupFailed(id, data.taskId, data.errorMessage, callback); // only notify for automated backups or timedout
case eventlog.ACTION_UPDATE_FINISH:
return boxUpdated(data.oldVersion, data.newVersion, callback);