Skip to content

Commit 573638f

Browse files
committed
Unexport helper command
1 parent d47e48f commit 573638f

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
22
<a href="https://uptrace.dev/?utm_source=gh-redis&utm_campaign=gh-redis-banner1">
3-
<img src="https://raw.githubusercontent.com/uptrace/roadmap/master/banner1.png">
3+
<img src="https://raw.githubusercontent.com/uptrace/roadmap/master/banner1.png" alt="All-in-one tool to optimize performance and monitor errors & logs">
44
</a>
55
</p>
66

export_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net"
77
"strings"
88

9+
"github.com/go-redis/redis/v8/internal"
910
"github.com/go-redis/redis/v8/internal/hashtag"
1011
"github.com/go-redis/redis/v8/internal/pool"
1112
)
@@ -82,3 +83,13 @@ func (state *clusterState) IsConsistent(ctx context.Context) bool {
8283

8384
return true
8485
}
86+
87+
func GetSlavesAddrByName(ctx context.Context, c *SentinelClient, name string) []string {
88+
addrs, err := c.Slaves(ctx, name).Result()
89+
if err != nil {
90+
internal.Logger.Printf(ctx, "sentinel: Slaves name=%q failed: %s",
91+
name, err)
92+
return []string{}
93+
}
94+
return parseSlaveAddrs(addrs, false)
95+
}

sentinel.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,6 @@ func (c *SentinelClient) GetMasterAddrByName(ctx context.Context, name string) *
317317
return cmd
318318
}
319319

320-
func (c *SentinelClient) GetSlavesAddrByName(ctx context.Context, name string) []string {
321-
addrs, err := c.Slaves(ctx, name).Result()
322-
if err != nil {
323-
internal.Logger.Printf(ctx, "sentinel: Slaves name=%q failed: %s",
324-
name, err)
325-
return []string{}
326-
}
327-
return parseSlaveAddrs(addrs, false)
328-
}
329-
330320
func (c *SentinelClient) Sentinels(ctx context.Context, name string) *SliceCmd {
331321
cmd := NewSliceCmd(ctx, "sentinel", "sentinels", name)
332322
_ = c.Process(ctx, cmd)

sentinel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var _ = Describe("Sentinel", func() {
6868
// Verify master->slaves sync.
6969
var slavesAddr []string
7070
Eventually(func() []string {
71-
slavesAddr = sentinel.GetSlavesAddrByName(ctx, sentinelName)
71+
slavesAddr = redis.GetSlavesAddrByName(ctx, sentinel, sentinelName)
7272
return slavesAddr
7373
}, "15s", "100ms").Should(HaveLen(2))
7474
Eventually(func() bool {

0 commit comments

Comments
 (0)