From 83f47db07f5de51db8e7d537cc87ec3a6d4bb4fe Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Fri, 22 Aug 2014 13:16:34 +0200 Subject: [PATCH] Pass worker result to success/failure handler instead of discarding it. --- js/server/modules/org/arangodb/foxx/queues/worker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/server/modules/org/arangodb/foxx/queues/worker.js b/js/server/modules/org/arangodb/foxx/queues/worker.js index b6146e79ea..b92afd3007 100644 --- a/js/server/modules/org/arangodb/foxx/queues/worker.js +++ b/js/server/modules/org/arangodb/foxx/queues/worker.js @@ -72,7 +72,8 @@ exports.work = function (job) { success = true, callback = null, now = Date.now(), - maxFailures; + maxFailures, + result; if (!cfg) { console.warn('Unknown job type for job ' + job._key + ':', job.type); @@ -87,7 +88,7 @@ exports.work = function (job) { ) || 0; try { - cfg.execute(job.data, job._id); + result = cfg.execute(job.data, job._id); } catch (executeErr) { console.error('Job ' + job._key + ' failed:', executeErr); job.failures.push(flatten(executeErr)); @@ -120,6 +121,7 @@ exports.work = function (job) { eval('(' + callback + ')(' + [ JSON.stringify(job._id), JSON.stringify(job.data), + JSON.stringify(result), JSON.stringify(job.failures) ].join(', ') + ')'); } catch (callbackErr) {