From ea806acb7e72da69ea9c725202a7a1d16a73bd21 Mon Sep 17 00:00:00 2001 From: darkyzhou Date: Tue, 15 Dec 2020 19:25:31 +0800 Subject: [PATCH] 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 :) --- sentinel.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sentinel.go b/sentinel.go index 0e32986..d785168 100644 --- a/sentinel.go +++ b/sentinel.go @@ -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 {