File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -666,15 +666,22 @@ func (c *sentinelFailover) discoverSentinels(ctx context.Context) {
666
666
}
667
667
for _ , sentinel := range sentinels {
668
668
vals := sentinel .([]interface {})
669
+ var ip , port string
669
670
for i := 0 ; i < len (vals ); i += 2 {
670
671
key := vals [i ].(string )
671
- if key == "name" {
672
- sentinelAddr := vals [i + 1 ].(string )
673
- if ! contains (c .sentinelAddrs , sentinelAddr ) {
674
- internal .Logger .Printf (ctx , "sentinel: discovered new sentinel=%q for master=%q" ,
675
- sentinelAddr , c .opt .MasterName )
676
- c .sentinelAddrs = append (c .sentinelAddrs , sentinelAddr )
677
- }
672
+ switch key {
673
+ case "ip" :
674
+ ip = vals [i + 1 ].(string )
675
+ case "port" :
676
+ port = vals [i + 1 ].(string )
677
+ }
678
+ }
679
+ if ip != "" && port != "" {
680
+ sentinelAddr := net .JoinHostPort (ip , port )
681
+ if ! contains (c .sentinelAddrs , sentinelAddr ) {
682
+ internal .Logger .Printf (ctx , "sentinel: discovered new sentinel=%q for master=%q" ,
683
+ sentinelAddr , c .opt .MasterName )
684
+ c .sentinelAddrs = append (c .sentinelAddrs , sentinelAddr )
678
685
}
679
686
}
680
687
}
You can’t perform that action at this time.
0 commit comments