diff --git a/examples/delayed.js b/examples/delayed.js index 054b6354..41de539e 100644 --- a/examples/delayed.js +++ b/examples/delayed.js @@ -36,7 +36,7 @@ jobs.create('email', { jobs.promote(); -jobs.process('email', 5, function(job, done){ +jobs.process('email', 10, function(job, done){ setTimeout(function(){ done(); }, Math.random() * 5000); diff --git a/lib/queue/worker.js b/lib/queue/worker.js index 5f2311c8..08a254e0 100644 --- a/lib/queue/worker.js +++ b/lib/queue/worker.js @@ -32,7 +32,7 @@ module.exports = Worker; function Worker(queue, type) { this.queue = queue; this.type = type; - this.client = redis.createClient(); + this.client = Worker.client || (Worker.client = redis.createClient()); this.interval = 1000; }