technoweenie / coffee-resque

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Workers not dequeing jobs

louisameline opened this issue · comments

Hello, thanks for this library !

I have this simplest piece of code that will not work as expected. The job is enqueued in the testing queue, I can see it in Redis, but never dequeued and 'Done' is never logged to console. The worker is not listed in Redis (I don't know if it should be, but my php-resque running workers are). I'm using Redis 2.8.6 and the latest version of this library. What am I missing ? Thank you.

// start worker
resque.worker('testing', {
    test: function(args, callback){
        // take other jobs anytime
        callback();
        console.log('Done');
    }
});

// enqueue a job
resque.enqueue('testing', 'test', [{
    test: 'test'
}]);

Is this the full code snippet? You need to start with a Connection instance, then create the worker and subsequently enqueue the job.

so something like this before the code you list above:

var resque = require('coffee-resque').connect({
  host: redisHost,
  port: redisPort
});

Similar to the examples on the README. If you are doing this first then there is another issue.

Yes, I am connecting before that snippet. The job is enqueued correctly, but nothing is dequeued. I really do the 2 things one right after the other, it's not the resque variable that would be at cause (did I mention that there is no error logged whatsoever).

did you start the worker?

Ah ! I missed that last line line, I'm sorry.
Maybe a "Don't forget to eventually start the worker" sentence before the example could avoid this careless mistake :)
Thanks again !

No worries! Glad I could help.