Closed edgracilla closed 7 years ago
Well you can't publish from an instance that's subscribing. You can have 2 connections with this little hack:
let redis = new Redis({
host: 'localhost',
port: 6379,
password: '',
dropBufferSupport: true,
keepAlive: 10000,
enableOfflineQueue: false
})
let redisSub = new Redis({
host: 'localhost',
port: 6379,
password: '',
dropBufferSupport: true,
keepAlive: 10000,
enableOfflineQueue: false
})
// Map subscribe to the subscription instance
redis.subscribe = redisSub.subscribe
let Queue = kue.createQueue({
prefix: 'w',
skipConfig: false,
restore: true,
redis: {
createClientFactory: function () {
return redis
}
}
})
We badly need 1 redis connection so the workaround might work but we cant deploy it. Ended up using bull instead.
btw, thank you @samhunta
We are trying to limit the connection count to redis so we need to reuse the existing connection, unfortunately re-using ioredis instance is not possible. Here is our code:
it returns the following error:
ReplyError: ERR only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context