From fc3e9de02e66a9d19c7f0d68ab8e8ab9eb0cf480 Mon Sep 17 00:00:00 2001 From: Jordi de Pablos Date: Fri, 30 Aug 2019 11:01:01 +0200 Subject: [PATCH 1/2] Add new attribute 'result' to job to record the job's execution result --- lib/job/run.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/job/run.js b/lib/job/run.js index d49f8e1e9..3e489c0d4 100644 --- a/lib/job/run.js +++ b/lib/job/run.js @@ -18,13 +18,17 @@ module.exports = function() { self.computeNextRunAt(); await self.save(); - const jobCallback = async err => { + const jobCallback = async (err, result) => { if (err) { self.fail(err); } else { self.attrs.lastFinishedAt = new Date(); } + if (result) { + self.attrs.result = result; + } + self.attrs.lockedAt = null; await self.save().catch(err => { From 16d8d6b627923cb5b083cf0675d953a515b66442 Mon Sep 17 00:00:00 2001 From: Jordi de Pablos Date: Fri, 30 Aug 2019 11:58:46 +0200 Subject: [PATCH 2/2] Remove space before function parentheses --- lib/job/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/job/run.js b/lib/job/run.js index 3e489c0d4..390895e22 100644 --- a/lib/job/run.js +++ b/lib/job/run.js @@ -18,7 +18,7 @@ module.exports = function() { self.computeNextRunAt(); await self.save(); - const jobCallback = async (err, result) => { + const jobCallback = async(err, result) => { if (err) { self.fail(err); } else {