Automattic / kue

Kue is a priority job queue backed by redis, built for node.js.
http://automattic.github.io/kue
MIT License
9.46k stars 866 forks source link

Cannot read property 'zrangebyscore' of null #962

Closed Deadly0 closed 8 years ago

Deadly0 commented 8 years ago

I have 2 different job processors for the job

file1

var queue = kue.createQueue()
queue.process('myjob', function() {
    // first processor for "myjob"
})

file2

var queue = kue.createQueue()
queue.process('myjob', function() {
    // second processor for "myjob"
})

When i run their together, it throws the error:

C:\Projects\avito-parser\node_modules\kue\lib\kue.js:185
client.zrangebyscore(client.getKey('jobs:delayed'), 0, Date.now(), 'LIMIT', 0, limit, function( err, ids ) {
                          ^

TypeError: Cannot read property 'zrangebyscore' of null
    at C:\Projects\avito-parser\node_modules\kue\lib\kue.js:185:15
    at Command.callback (C:\Projects\avito-parser\node_modules\node-redis-warlock\lib\warlock.js:39:16)
    at normal_reply (C:\Projects\avito-parser\node_modules\redis\index.js:714:21)
    at RedisClient.return_reply (C:\Projects\avito-parser\node_modules\redis\index.js:816:9)
    at JavascriptRedisParser.Parser.returnReply (C:\Projects\avito-parser\node_modules\redis\index.js:188:18)
    at JavascriptRedisParser.execute (C:\Projects\avito-parser\node_modules\redis-parser\lib\parser.js:415:12)
    at Socket.<anonymous> (C:\Projects\avito-parser\node_modules\redis\index.js:267:27)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)

Is it possible to use Kue in this way? PS looks like the issue happened only when i shutdown the queue and then create it again.

Deadly0 commented 8 years ago

I've re-designed my app and issue disappeared.