kue (reds?) creates always a Redis connection to localhost when requiring
See original GitHub issueDon’t know if this is kue or reds issue, but it certainly affects kue. Tested on kue master.
Consider following:
var redis = require("redis");
var client = redis.createClient(1234, "example.com");
setTimeout(function() {
require("kue");
}, 1000);
client.on("connect", function() {
console.log("Connected!");
});
It dies immediately after kue is required in the timeout:
Connected!
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Redis connection to 127.0.0.1:6379 failed - ECONNREFUSED, Connection refused
at Socket.<anonymous> (/home/epeli/tmp/kue/node_modules/reds/node_modules/redis/index.js:123:28)
at Socket.emit (events.js:64:17)
at Array.<anonymous> (net.js:830:27)
at EventEmitter._tickCallback (node.js:126:26)
shell returned 1
Creates a second connection to localhost?
I think the reason is here:
A search is created on require https://github.com/LearnBoost/kue/blob/b2cd5d3393d12e4bdd1c2e654a3ef5eb45e5bf11/lib/queue/job.js#L27
which means new Search on Reds https://github.com/visionmedia/reds/blob/156c046803df6b96fa40e90be26b933f7d324d01/lib/reds.js#L68
which then again means a new Redis client which connects to localhost https://github.com/visionmedia/reds/blob/156c046803df6b96fa40e90be26b933f7d324d01/lib/reds.js#L236
This happens also if you override the createClient function in kue.
Issue Analytics
- State:
- Created 12 years ago
- Comments:39 (11 by maintainers)
Top Results From Across the Web
node.js - Connecting to redis using kue always creates a ...
I used a different way to setup the connection and it works so far this is what I've done: app.redisClient = redis.createClient(config.redisPort, config....
Read more >Redis with Node.js (node_redis) | Redis Documentation Center
To use Redis with Node.js, you need to install a Node.js Redis client. The following sections explain ... The following code creates a...
Read more >Step 4: Connect to the cluster's node - Amazon ElastiCache ...
Log in to an Amazon EC2 instance and connect to a node in the cache cluster. ... Choose the cluster you created in...
Read more >Redis client connects to the redis remote server but can't read ...
I've to manage two servers 'Node_server' and a redis server ... var RedisStore = require('connect-redis')(session); var bodyParser ...
Read more >Getting started with Redis
Running redis-cli followed by a command name and its arguments will send this command to the Redis instance running on localhost at port...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve been beating my head against this wall for a full day now. I’m running kue version 0.11 and node 4.5 but still cannot connect to a remote host. here is what my connection looks like:
No matter what I try I get the same error back:
I have tried every example I can find and still nothing… 😦
Any help is greatly appreciated.
@rvbsanjose make sure if you are calling createQueue(…) before accessing
kue.app
express application, and also try withdisableSearch: true
. Finally provide the code so that I can fix it, however I don’t believe it is a bug.