Merge pull request from go-redis/fix/retry-same

cluster: retry same node on retryable error
This commit is contained in:
Vladimir Mihailenco 2018-05-17 15:17:46 +03:00 committed by GitHub
commit d5f5c24505
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) {
// Firstly retry the same node.
if attempt == 0 {
continue
}
// Secondly try random node.
node, err = c.nodes.Random()
if err != nil {
break