Previously the proxy would stall requests on error or when there are no nodes. This can happen if a node fails to gracefully shutdown or all nodes are down for maintenance or restarting.
This change attempts to detect failed nodes and to make and attempt at unregistering and cleaning up its presence. The request is then re-routed. If there are no nodes, status 503 is returned to prevent blocking the request indefinitely.
Possible improvements or issues
Is proxy.on("error") a reliable way to detect a failed node? Legitimate server errors seem to avoid it as expected.
I regret having to partially duplicate the redis code in cleanUpNode, but could not think of another way
Previously the proxy would stall requests on error or when there are no nodes. This can happen if a node fails to gracefully shutdown or all nodes are down for maintenance or restarting.
This change attempts to detect failed nodes and to make and attempt at unregistering and cleaning up its presence. The request is then re-routed. If there are no nodes, status 503 is returned to prevent blocking the request indefinitely.
Possible improvements or issues