forked from mirror/redis
cmdsInfo to actually use and return the first error
This commit is contained in:
parent
76f0041b12
commit
0557f66418
5
ring.go
5
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue