Automattic / kue

Kue is a priority job queue backed by redis, built for node.js.
http://automattic.github.io/kue
MIT License
9.45k stars 862 forks source link

Number of workers and Error: Redis connection to 127.0.0.1:6379 failed - read ECONNRESET #1167

Open ashleydavis opened 6 years ago

ashleydavis commented 6 years ago

Thanks for Kue, it's pretty remarkable.

I'm having a problem with it and I was wondering if Kue has a limit on the number of workers?

In my app I've tried to fork 12 workers using the cluster module. When I run this it very quickly aborts with the error:

Error: Redis connection to 127.0.0.1:6379 failed - read ECONNRESET

If I hard-code the number of workers to just 1 it seems to work ok.

ashleydavis commented 6 years ago

I've got a work around for this problem. It's related to having too many workers and using node-redis.

I've switched over to ioredis and it works well for me now.

This is the code:

var Redis = require('ioredis');

const queue = kue.createQueue({
    prefix: id,
    redis: {
        createClientFactory: function(){
            return new Redis();
        }
    },
});