From 535834c0d2823c21750c310d669c2d4d170a0718 Mon Sep 17 00:00:00 2001
From: Tristan Cavelier <tristan.cavelier@tiolive.com>
Date: Mon, 26 Aug 2013 13:28:44 +0200
Subject: [PATCH] job checker upgraded to manage job wait

---
 src/jio/features/jobChecker.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/jio/features/jobChecker.js b/src/jio/features/jobChecker.js
index 530db4a..335af73 100644
--- a/src/jio/features/jobChecker.js
+++ b/src/jio/features/jobChecker.js
@@ -20,8 +20,11 @@ function enableJobChecker(jio, shared, options) {
 
   shared.job_rule_actions = {
     wait: function (original_job, new_job) {
-      // XXX
-      return;
+      original_job.deferred.promise().always(function () {
+        shared.emit('job', new_job);
+      });
+      new_job.state = 'waiting';
+      new_job.modified = new Date();
     },
     update: function (original_job, new_job) {
       if (!new_job.deferred) {
@@ -38,6 +41,7 @@ function enableJobChecker(jio, shared, options) {
         }
       }
       new_job.state = 'running';
+      new_job.modified = new Date();
     },
     deny: function (original_job, new_job) {
       // XXX
-- 
2.30.9