Move status close to entity

This commit is contained in:
Raul Ochoa 2016-10-19 10:45:37 +02:00
parent ca3d71ea48
commit e26bed2e66

View File

@ -7,12 +7,6 @@ var debug = require('../util/debug')('scheduler');
var forever = require('../util/forever');
var STATUS = {
PENDING: 'pending',
RUNNING: 'running',
DONE: 'done'
};
function Scheduler(capacity, taskRunner) {
EventEmitter.call(this);
this.taskRunner = taskRunner;
@ -116,6 +110,15 @@ Scheduler.prototype.release = function(err, taskEntity) {
this.emit('release');
};
/* Task entities */
var STATUS = {
PENDING: 'pending',
RUNNING: 'running',
DONE: 'done'
};
function TaskEntity(user) {
this.user = user;
this.status = STATUS.PENDING;