diff --git a/batch/scheduler/host-scheduler.js b/batch/scheduler/host-scheduler.js index 0e143c82..62dc4ead 100644 --- a/batch/scheduler/host-scheduler.js +++ b/batch/scheduler/host-scheduler.js @@ -24,7 +24,9 @@ HostScheduler.prototype.add = function(host, user, callback) { if (err) { return callback(err); } - var wasRunning = scheduler.add(user); + scheduler.add(user); + var wasRunning = scheduler.schedule(); + debug('Scheduler host=%s was running = %s', host, wasRunning); return callback(err, wasRunning); }); }; diff --git a/batch/scheduler/scheduler.js b/batch/scheduler/scheduler.js index 63e1d4c0..db342d5a 100644 --- a/batch/scheduler/scheduler.js +++ b/batch/scheduler/scheduler.js @@ -25,12 +25,15 @@ Scheduler.prototype.add = function(user) { if (task.status === STATUS.DONE) { task.status = STATUS.PENDING; } + + return true; } else { task = new TaskEntity(user); this.tasks.push(task); this.users[user] = task; + + return false; } - return this.schedule(); }; Scheduler.prototype.schedule = function() {