From 0557f664188f5bb285933c85956b02058fbfe918 Mon Sep 17 00:00:00 2001 From: Philip Manavopoulos Date: Thu, 7 May 2020 15:14:16 +0100 Subject: [PATCH] cmdsInfo to actually use and return the first error --- ring.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ring.go b/ring.go index f046cc6c..059ffdf9 100644 --- a/ring.go +++ b/ring.go @@ -508,7 +508,7 @@ func (c *Ring) ForEachShard( func (c *Ring) cmdsInfo() (map[string]*CommandInfo, error) { shards := c.shards.List() - firstErr := errRingShardsDown + var firstErr error for _, shard := range shards { cmdsInfo, err := shard.Client.Command(context.TODO()).Result() if err == nil { @@ -518,6 +518,9 @@ func (c *Ring) cmdsInfo() (map[string]*CommandInfo, error) { firstErr = err } } + if firstErr == nil { + return nil, errRingShardsDown + } return nil, firstErr }