make error message for unreachable sentinels more clear

The original text `all sentinels are unreachable` can sometimes be misleading, making some users think that all of their redis sentinels are down.

But it might not be the reality especially when using kubernetes and specify `c.sentinelAddrs` as the Service's domain. In this case, when the sentinel to which the domain is redirected runs into some errors despite other sentinels running healthily, the original text given by redis client will be confusing and delivering false message!

Just got out of a similar dilemma after checking the source code, feel free to correct me if I am wrong :)
This commit is contained in:
darkyzhou 2020-12-15 19:25:31 +08:00 committed by GitHub
parent 19e561f0f0
commit ea806acb7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -485,7 +485,7 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
return addr, nil
}
return "", errors.New("redis: all sentinels are unreachable")
return "", errors.New("redis: all sentinels specified in configuration are unreachable")
}
func (c *sentinelFailover) slaveAddrs(ctx context.Context) ([]string, error) {
@ -530,7 +530,7 @@ func (c *sentinelFailover) slaveAddrs(ctx context.Context) ([]string, error) {
return addrs, nil
}
return []string{}, errors.New("redis: all sentinels are unreachable")
return []string{}, errors.New("redis: all sentinels specified in configuration are unreachable")
}
func (c *sentinelFailover) getMasterAddr(ctx context.Context, sentinel *SentinelClient) string {