cluster: retry same node on retryable error

This commit is contained in:
Vladimir Mihailenco 2018-05-17 15:02:35 +03:00
parent 467749ade8
commit 092971361b
1 changed files with 6 additions and 0 deletions

View File

@ -816,6 +816,12 @@ func (c *ClusterClient) defaultProcess(cmd Cmder) error {
} }
if internal.IsRetryableError(err, true) { if internal.IsRetryableError(err, true) {
// Firstly retry the same node.
if attempt == 0 {
continue
}
// Secondly try random node.
node, err = c.nodes.Random() node, err = c.nodes.Random()
if err != nil { if err != nil {
break break