Add a timeout for update as well

this will send a notification if an update gets stuck
This commit is contained in:
Girish Ramakrishnan
2019-10-14 09:30:20 -07:00
parent 488763fc42
commit a19662bdfa
5 changed files with 64 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ exports = module.exports = {
backupFailed: backupFailed,
certificateRenewalError: certificateRenewalError,
boxUpdateError: boxUpdateError,
sendTestMail: sendTestMail,
@@ -411,6 +412,24 @@ function certificateRenewalError(mailTo, domain, message) {
});
}
function boxUpdateError(mailTo, message) {
assert.strictEqual(typeof mailTo, 'string');
assert.strictEqual(typeof message, 'string');
getMailConfig(function (error, mailConfig) {
if (error) return debug('Error getting mail details:', error);
var mailOptions = {
from: mailConfig.notificationFrom,
to: mailTo,
subject: util.format('[%s] Cloudron update error', mailConfig.cloudronName),
text: render('box_update_error.ejs', { message: message, format: 'text' })
};
sendMail(mailOptions);
});
}
function oomEvent(mailTo, program, event) {
assert.strictEqual(typeof mailTo, 'string');
assert.strictEqual(typeof program, 'string');