1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

fix test error

Signed-off-by: monkey <golang@88.com>
This commit is contained in:
monkey
2021-03-12 19:06:11 +08:00
parent 250f81bf06
commit af3827aeab
5 changed files with 46 additions and 6 deletions

View File

@ -317,6 +317,16 @@ func (c *SentinelClient) GetMasterAddrByName(ctx context.Context, name string) *
return cmd
}
func (c *SentinelClient) GetSlavesAddrByName(ctx context.Context, name string) []string {
addrs, err := c.Slaves(ctx, name).Result()
if err != nil {
internal.Logger.Printf(ctx, "sentinel: Slaves name=%q failed: %s",
name, err)
return []string{}
}
return parseSlaveAddrs(addrs, false)
}
func (c *SentinelClient) Sentinels(ctx context.Context, name string) *SliceCmd {
cmd := NewSliceCmd(ctx, "sentinel", "sentinels", name)
_ = c.Process(ctx, cmd)