mirror of https://github.com/go-redis/redis.git
Unexport helper command
This commit is contained in:
parent
d47e48f8ab
commit
573638ff0c
|
@ -1,6 +1,6 @@
|
|||
<p align="center">
|
||||
<a href="https://uptrace.dev/?utm_source=gh-redis&utm_campaign=gh-redis-banner1">
|
||||
<img src="https://raw.githubusercontent.com/uptrace/roadmap/master/banner1.png">
|
||||
<img src="https://raw.githubusercontent.com/uptrace/roadmap/master/banner1.png" alt="All-in-one tool to optimize performance and monitor errors & logs">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/go-redis/redis/v8/internal"
|
||||
"github.com/go-redis/redis/v8/internal/hashtag"
|
||||
"github.com/go-redis/redis/v8/internal/pool"
|
||||
)
|
||||
|
@ -82,3 +83,13 @@ func (state *clusterState) IsConsistent(ctx context.Context) bool {
|
|||
|
||||
return true
|
||||
}
|
||||
|
||||
func GetSlavesAddrByName(ctx context.Context, c *SentinelClient, 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)
|
||||
}
|
||||
|
|
10
sentinel.go
10
sentinel.go
|
@ -317,16 +317,6 @@ 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)
|
||||
|
|
|
@ -68,7 +68,7 @@ var _ = Describe("Sentinel", func() {
|
|||
// Verify master->slaves sync.
|
||||
var slavesAddr []string
|
||||
Eventually(func() []string {
|
||||
slavesAddr = sentinel.GetSlavesAddrByName(ctx, sentinelName)
|
||||
slavesAddr = redis.GetSlavesAddrByName(ctx, sentinel, sentinelName)
|
||||
return slavesAddr
|
||||
}, "15s", "100ms").Should(HaveLen(2))
|
||||
Eventually(func() bool {
|
||||
|
|
Loading…
Reference in New Issue