From 092971361bcfb3fd8c0cb21d55f959ddd5cecbca Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Thu, 17 May 2018 15:02:35 +0300 Subject: [PATCH] cluster: retry same node on retryable error --- cluster.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cluster.go b/cluster.go index 5991afdd..5e6b52c6 100644 --- a/cluster.go +++ b/cluster.go @@ -816,6 +816,12 @@ func (c *ClusterClient) defaultProcess(cmd Cmder) error { } if internal.IsRetryableError(err, true) { + // Firstly retry the same node. + if attempt == 0 { + continue + } + + // Secondly try random node. node, err = c.nodes.Random() if err != nil { break