I'm trying to handle the "completed" event but looks like it's not working:
var queue = Queue('crawler', 6379, '127.0.0.1');
queue.on('completed', function(job, result){
console.log( "Queue completed job:" );
});
Perhaps I'm doing something wrong but the method is not triggered.
Thanks.
Note that completed is only available locally on the server that processed the job. Is your 'crawler' event being processed elsewhere?
Yes, I'm trying to get the event on the server that publishes the jobs, but I guess this is not possible.
@cosmonova of course it is possible. There are unit tests that covers this scenario. Please provide a complete example code where this can be reproduced and we will look into it.
so I have a controller which is deployed on one server with the following code:
var queue = Queue('crawler', 6379, '127.0.0.1');
queue.add( {endpoint: '1234'} );
queue.on('completed', function(job, result){
console.log( "Queue completed job: ", job.data );
})
and the processor which runs on a different server:
var queue = Queue('crawler', 6379, '127.0.0.1');
queue.process(function (job, done) {
console.log(job.data);
done();
});
That example code should work using the master branch, since we have distributed events now, it is not released yet since it needs a bit more time to mature.
Thanks,
I'll give it a try from the master branch.
tried master branch without luck.
please try with version 1.1.0
yes it works now. thank you.
Not working for me either. Working fine when the job is processed on the same server as the request, but not when they are separate. I tried v3.0.0-rc4 and v1.1.0
Most helpful comment
Not working for me either. Working fine when the job is processed on the same server as the request, but not when they are separate. I tried v3.0.0-rc4 and v1.1.0