diff --git a/lib/index.js b/lib/index.js index 83b02a0..3f1a3a4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -384,6 +384,10 @@ Runner.prototype = { var jobdata = self.jobdata.pop(job._id); if (!jobdata) return next(err); + // Mark jobs as finished. + delete jobdata.data; + jobdata.finished = new Date(); + if (err) { jobdata.errored = true; jobdata.error = { @@ -392,14 +396,10 @@ Runner.prototype = { }; self.emitter.emit('browser.update', job.project.name, 'job.status.errored', [job._id, jobdata.error]); - delete jobdata.data; - jobdata.finished = new Date(); debug(`[runner:${self.id}] Job done with error. Project: ${job.project.name} Job ID: ${job._id}`); return next(err); } - delete jobdata.data; - jobdata.finished = new Date(); self.emitter.emit('job.done', jobdata); debug(`[runner:${self.id}] Job done without error. Project: ${job.project.name} Job ID: ${job._id}`); next();