[createClientFactory] Trying to connect to localhost when using createClientFactory
Kue is trying to make a connect to localhost after I have successfully connected to a non-localhost redis server.
events.js:141
throw er; // Unhandled 'error' event
^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
This happens after I successfully connect to my redis server (which does not sit on localhost).
My dependencies:
├── [email protected]
├── [email protected]
├── [email protected]
I am using node-redis has my redisClient:
app.redisClient = redis.createClient(config.redis.port, config.redis.host);
app.jobs = kue.createQueue({
redis: {
createClientFactory: function () {
return app.redisClient;
}
},
disableSearch: true
});
Is Kue trying to make another connection for another feature that I am not across?
Cheers, Peter
in createClientFactory You should return a configured client instance not the factory method app.redisClient
Sorry, I missed that in the initial post.
app.redisClient = redis.createClient(config.redis.port, config.redis.host);
I know connection is successful because I logged it:
app.redisClient.on('connect', function () {
console.info('successful connection to redis server');
});
But soon right after I get the error mentioned above
successful connection to redis server
events.js:141
throw er; // Unhandled 'error' event
^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
I solved it by using the default redis client from Kue
app.jobs = kue.createQueue({
prefix: config.redis.prefix,
redis: {
port: config.redis.port,
host: config.redis.host
}
});
Then I shall rename the topic if you don't mind
Hello. I had the same issue with an app. We had attached a debugger and, when stepping through the functions, kue resolves the name just fine. However, when we let it run without stepping, it tries to connect to 127.0.0.1 instead.
We saw that, when we call createQueue during the step through, the Queue singleton already exists. Is that expected?
Does this function have some kind of callback?