From 0afd4c06b253512b720262e01aae173a2bfa55cc Mon Sep 17 00:00:00 2001 From: Tristan Cavelier <tristan.cavelier@tiolive.com> Date: Thu, 5 Sep 2013 09:29:02 +0200 Subject: [PATCH] command.reject acts like an error or a retry according to the status code --- src/jio/features/jobRetry.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/jio/features/jobRetry.js b/src/jio/features/jobRetry.js index 9ceca69..ca79769 100644 --- a/src/jio/features/jobRetry.js +++ b/src/jio/features/jobRetry.js @@ -1,5 +1,5 @@ /*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true, unparam: true */ -/*global arrayExtend, setTimeout, indexOf, min */ +/*global arrayExtend, setTimeout, indexOf, min, constants */ function enableJobRetry(jio, shared, options) { @@ -58,6 +58,13 @@ function enableJobRetry(jio, shared, options) { defaultMaxRetry(param) ); } + param.command.reject = function (status) { + if (constants.http_action[status || 0] === "retry") { + shared.emit('jobRetry', param, arguments); + } else { + shared.emit('jobFail', param, arguments); + } + }; param.command.retry = function () { shared.emit('jobRetry', param, arguments); }; -- 2.30.9