I'm having trouble connecting to redis to go with multiple worker processes using kue in heroku. I can connect with multiple workers to redis on localhost but it seems to break on connecting with redis-to-go. This only seems to break when I have multiple kue workers/processes running.
kue.redis.createClient = function() {
var client;
client = redis.createClient(1234, 'tetra.redistogo.com');
client.auth('xyz');
return client;
};
jobs = kue.createQueue();
jobs.process("email, 2, function(job, done) {
console.log("processing email");
return done(null, null);
});
gets an error
Error: Uncaught, unspecified 'error' event.
at RedisClient.emit (events.js:47:15)
at Command.callback (/Users/transformer/Projects/Pictorious/Services/node_modules/redis/index.js:159:29)
at RedisClient.return_error (/Users/transformer/Projects/Pictorious/Services/node_modules/redis/index.js:446:25)
at RedisReplyParser. (/Users/transformer/Projects/Pictorious/Services/node_modules/redis/index.js:256:14)
at RedisReplyParser.emit (events.js:64:17)
at RedisReplyParser.send_error (/Users/transformer/Projects/Pictorious/Services/node_modules/redis/lib/parser/javascript.js:266:14)
at RedisReplyParser.execute (/Users/transformer/Projects/Pictorious/Services/node_modules/redis/lib/parser/javascript.js:125:22)
at RedisClient.on_data (/Users/transformer/Projects/Pictorious/Services/node_modules/redis/index.js:422:27)
at Socket. (/Users/transformer/Projects/Pictorious/Services/node_modules/redis/index.js:66:14)
at Socket.emit (events.js:64:17)
If you're using Redis To Go nano instance (e.g. the free one) you may be running into a connection limit. You are only allowed 10 connections and it seems that kue is doing redis.client() a lot. So, you could be hitting that limit.
To find out for sure, add
redis.debug_mode = true;
before you do any work and see what the output says (note: it's going to spit out a lot of info, b\c there are a lot of connections happening, however "max connections" error at or near the end of the output.At least we seem to be hitting this limit when we have a worker and client both accessing kue.
Hope this helps.