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

@@ -249,10 +249,13 @@ function updateToLatest(options, auditSource, callback) {
eventlog.add(eventlog.ACTION_UPDATE, auditSource, { taskId, boxUpdateInfo });
tasks.startTask(taskId, {}, (error) => {
tasks.startTask(taskId, { timeout: 20 * 60 * 60 * 1000 /* 20 hours */ }, (error) => {
locker.unlock(locker.OP_BOX_UPDATE);
debug('Update failed with error', error);
const timedOut = error.code === tasks.ETIMEOUT;
eventlog.add(eventlog.ACTION_UPDATE_FINISH, auditSource, { taskId, errorMessage: error.message, timedOut });
});
callback(null, taskId);