我无法在heroku中使用kue连接到redis以使用多个工作进程。我可以与多个工作人员连接到本地主机上的redis,但它似乎在与redis-to-go连接时中断。当我有多个kue worker /进程在运行时,这似乎只会中断。
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);
});
收到错误
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)
答案 0 :(得分:1)
如果您使用的是Redis To Go nano实例(例如免费的实例),您可能会遇到连接限制。你只允许10个连接,似乎kue正在做很多redis.client()。所以,你可能会达到这个极限。
要确定,请在执行任何工作之前添加redis.debug_mode = true;
并查看输出内容(注意:它会吐出大量信息,b \ c发生了很多连接,但是在输出结束时或附近出现“最大连接数”错误。
当我们让工人和客户都访问kue时,至少我们似乎达到了这个限制。
希望这有帮助。