Resolves a bug with cluster where a subscribe is sent to a disconnected node#63
Conversation
|
When a node is disconnected(https://github.com/luin/ioredis/blob/master/lib/cluster.js#L407), ioredis will re-select a new subscriber automatically(https://github.com/luin/ioredis/blob/master/lib/cluster.js#L164). So you don't need to call |
|
Oh, I see what you mean. However this commit did resolve the issue we were having. I'll comment shortly with the debug logs so you can see what was happening. |
2b5cccc to
1cb1575
Compare
|
Here is a snippet of the debug output before the patch. I added a couple console lines to clarify which command was being sent and whether the stream was writable. |
|
I updated the commit with what I believe is a more appropriate fix based on your feedback. Thanks |
Resolves a bug with cluster where a subscribe is sent to a disconnected node
|
Awesome! Thank you for the patch! |
The issue came up when connecting to a load balancer, sitting in front of the redis cluster nodes, and attempting to subscribe as soon as the 'ready' event was fired. The load balancer's IP:port is not in redis cluster's list of nodes so the connection was disconnected and removed, causing the subscribe to be sent to the disconnected node.