javascript - Kue worker with with createClientFactory: only subscriber commands may be used -
i'm working kue workers set , have discovered strange. if create queue using default kue redis connection works perfectly:
var kue = require('kue') , redis = require('redis'); var q = kue.createqueue(); q.process('cypher', function(job, done){});
the worker starts perfectly. however, if try override default redis connection 1 of own
error: connection in subscriber mode, subscriber commands may used
when execution hits q.process function below:
var kue = require('kue') , redis = require('redis'); var redisclient = redis.createclient(); var q = kue.createqueue({ redis: { createclientfactory: function(){ return redisclient; } } }); q.process('cypher', function(job, done){});
it doesn't seem sense. thought maybe committing classic async error, following same error. any insights?
redisclient.on('connect', function () { console.log('gotten here!!!'); var q = kue.createqueue({ redis: { createclientfactory: function(){ return redisclient; } } }); q.process('cypher', function(job, done){}); });
you not passing new client each time when factory method called. returning singleton instance createclientfactory makes kue use same connection commands , pub/sub , not possible in redis connection modes
Comments
Post a Comment