Commit 89403981 authored by Tristan Cavelier's avatar Tristan Cavelier

JIO recovers only writer jobs

parent 31f0324f
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true, unparam: true */ /*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true, unparam: true */
/*global setTimeout */ /*global setTimeout, methodType */
function enableJobRecovery(jio, shared, options) { function enableJobRecovery(jio, shared, options) {
...@@ -16,9 +16,15 @@ function enableJobRecovery(jio, shared, options) { ...@@ -16,9 +16,15 @@ function enableJobRecovery(jio, shared, options) {
function recoverJob(param) { function recoverJob(param) {
shared.job_queue.remove(param.id); shared.job_queue.remove(param.id);
delete param.id;
if (methodType(param.method) === 'writer' ||
param.state === 'ready' ||
param.state === 'running' ||
param.state === 'waiting') {
shared.job_queue.save(); shared.job_queue.save();
shared.emit('job', param); shared.emit('job', param);
} }
}
function jobWaiter(id, modified) { function jobWaiter(id, modified) {
return function () { return function () {
...@@ -45,9 +51,6 @@ function enableJobRecovery(jio, shared, options) { ...@@ -45,9 +51,6 @@ function enableJobRecovery(jio, shared, options) {
job_array = shared.job_queue.asArray(); job_array = shared.job_queue.asArray();
for (i = 0; i < job_array.length; i += 1) { for (i = 0; i < job_array.length; i += 1) {
if (job_array[i].state === 'ready' ||
job_array[i].state === 'running' ||
job_array[i].state === 'waiting') {
delay = numberOrDefault(job_array[i].timeout + recovery_delay, delay = numberOrDefault(job_array[i].timeout + recovery_delay,
recovery_delay); recovery_delay);
deadline = new Date(job_array[i].modified).getTime() + delay; deadline = new Date(job_array[i].modified).getTime() + delay;
...@@ -64,7 +67,6 @@ function enableJobRecovery(jio, shared, options) { ...@@ -64,7 +67,6 @@ function enableJobRecovery(jio, shared, options) {
deadline - Date.now()); deadline - Date.now());
} }
} }
}
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment