diff --git a/src/tasks.js b/src/tasks.js index daa93fc39..cbf4fa5bd 100644 --- a/src/tasks.js +++ b/src/tasks.js @@ -30,6 +30,7 @@ exports = module.exports = { // error codes ESTOPPED: 'stopped', ECRASHED: 'crashed', + ETIMEOUT: 'timeout', // testing _TASK_IDENTITY: '_identity', @@ -186,7 +187,7 @@ function startTask(taskId, options, callback) { if (!error && task.percent !== 100) { // task crashed or was killed by us taskError = { message: code === 0 ? `Task ${taskId} ${timedOut ? 'timed out' : 'stopped'}` : `Task ${taskId} crashed with code ${code} and signal ${signal}`, - code: code === 0 ? exports.ESTOPPED : exports.ECRASHED + code: code === 0 ? (timedOut ? exports.ETIMEOUT : exports.ESTOPPED) : exports.ECRASHED }; // note that despite the update() here, we should handle the case where the box code was restarted and never got taskworker exit setCompleted(taskId, { error: taskError }, NOOP_CALLBACK);