Start scheduler from host-scheduler

This commit is contained in:
Raul Ochoa 2016-10-19 11:45:48 +02:00
parent e26bed2e66
commit 4daa39bd2c
2 changed files with 7 additions and 2 deletions

View File

@ -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);
});
};

View File

@ -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() {