Commit a4bba05b authored by Tristan Cavelier's avatar Tristan Cavelier

job queue is not well cleaned -> fixed

parent d0802be2
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true, unparam: true */ /*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true, unparam: true */
/*global arrayInsert, indexOf, deepClone, defaults */ /*global arrayInsert, indexOf, deepClone, defaults, IODeferred */
// creates // creates
// - some defaults job rule actions // - some defaults job rule actions
...@@ -44,8 +44,9 @@ function enableJobChecker(jio, shared, options) { ...@@ -44,8 +44,9 @@ function enableJobChecker(jio, shared, options) {
new_job.modified = new Date(); new_job.modified = new Date();
}, },
deny: function (original_job, new_job) { deny: function (original_job, new_job) {
new_job.state = 'running'; new_job.state = 'fail';
new_job.command.reject( new_job.modified = new Date();
IODeferred.createFromParam(new_job).reject(
'precondition_failed', 'precondition_failed',
'command denied', 'command denied',
'Command rejected by the job checker.' 'Command rejected by the job checker.'
......
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true, unparam: true */ /*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true, unparam: true */
/*global arrayExtend, localStorage, Workspace, uniqueJSONStringify, JobQueue, /*global arrayExtend, localStorage, Workspace, uniqueJSONStringify, JobQueue,
constants */ constants, indexOf */
function enableJobQueue(jio, shared, options) { function enableJobQueue(jio, shared, options) {
...@@ -40,12 +40,14 @@ function enableJobQueue(jio, shared, options) { ...@@ -40,12 +40,14 @@ function enableJobQueue(jio, shared, options) {
); );
shared.on('job', function (param) { shared.on('job', function (param) {
if (indexOf(param.state, ['fail', 'done']) === -1) {
if (!param.stored) { if (!param.stored) {
shared.job_queue.load(); shared.job_queue.load();
shared.job_queue.post(param); shared.job_queue.post(param);
shared.job_queue.save(); shared.job_queue.save();
param.stored = true; param.stored = true;
} }
}
}); });
['jobRun', 'jobStop'].forEach(function (event) { ['jobRun', 'jobStop'].forEach(function (event) {
......
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