From e26bed2e66c54e29c563eef8214451d801d1fdf3 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Wed, 19 Oct 2016 10:45:37 +0200 Subject: [PATCH] Move status close to entity --- batch/scheduler/scheduler.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/batch/scheduler/scheduler.js b/batch/scheduler/scheduler.js index 65cb1fb2..63e1d4c0 100644 --- a/batch/scheduler/scheduler.js +++ b/batch/scheduler/scheduler.js @@ -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;