Skip to content

Commit 3bfb847

Browse files
committed
rename a data member _masterAddr to masterAddr
Signed-off-by: Xiaolong Chen <[email protected]>
1 parent 856a208 commit 3bfb847

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

osscluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1984,7 +1984,7 @@ func (c *ClusterClient) MasterForKey(ctx context.Context, key string) (*Client,
19841984
if err != nil {
19851985
return nil, err
19861986
}
1987-
return node.Client, err
1987+
return node.Client, nil
19881988
}
19891989

19901990
func (c *ClusterClient) context(ctx context.Context) context.Context {

sentinel.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,10 @@ type sentinelFailover struct {
655655
onFailover func(ctx context.Context, addr string)
656656
onUpdate func(ctx context.Context)
657657

658-
mu sync.RWMutex
659-
_masterAddr string
660-
sentinel *SentinelClient
661-
pubsub *PubSub
658+
mu sync.RWMutex
659+
masterAddr string
660+
sentinel *SentinelClient
661+
pubsub *PubSub
662662
}
663663

664664
func (c *sentinelFailover) Close() error {
@@ -919,7 +919,7 @@ func parseReplicaAddrs(addrs []map[string]string, keepDisconnected bool) []strin
919919

920920
func (c *sentinelFailover) trySwitchMaster(ctx context.Context, addr string) {
921921
c.mu.RLock()
922-
currentAddr := c._masterAddr //nolint:ifshort
922+
currentAddr := c.masterAddr //nolint:ifshort
923923
c.mu.RUnlock()
924924

925925
if addr == currentAddr {
@@ -929,10 +929,10 @@ func (c *sentinelFailover) trySwitchMaster(ctx context.Context, addr string) {
929929
c.mu.Lock()
930930
defer c.mu.Unlock()
931931

932-
if addr == c._masterAddr {
932+
if addr == c.masterAddr {
933933
return
934934
}
935-
c._masterAddr = addr
935+
c.masterAddr = addr
936936

937937
internal.Logger.Printf(ctx, "sentinel: new master=%q addr=%q",
938938
c.opt.MasterName, addr)

0 commit comments

Comments
 (0)