Skip to content

Commit ea806ac

Browse files
authored
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 :)
1 parent 19e561f commit ea806ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sentinel.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
485485
return addr, nil
486486
}
487487

488-
return "", errors.New("redis: all sentinels are unreachable")
488+
return "", errors.New("redis: all sentinels specified in configuration are unreachable")
489489
}
490490

491491
func (c *sentinelFailover) slaveAddrs(ctx context.Context) ([]string, error) {
@@ -530,7 +530,7 @@ func (c *sentinelFailover) slaveAddrs(ctx context.Context) ([]string, error) {
530530
return addrs, nil
531531
}
532532

533-
return []string{}, errors.New("redis: all sentinels are unreachable")
533+
return []string{}, errors.New("redis: all sentinels specified in configuration are unreachable")
534534
}
535535

536536
func (c *sentinelFailover) getMasterAddr(ctx context.Context, sentinel *SentinelClient) string {

0 commit comments

Comments
 (0)