File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,7 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
177177 opt .init ()
178178
179179 connPool := newConnPool (opt )
180+
180181 failover .mu .Lock ()
181182 failover .onFailover = func (ctx context.Context , addr string ) {
182183 _ = connPool .Filter (func (cn * pool.Conn ) bool {
@@ -648,6 +649,7 @@ func (c *sentinelFailover) discoverSentinels(ctx context.Context) {
648649
649650func (c * sentinelFailover ) listen (pubsub * PubSub ) {
650651 ctx := context .TODO ()
652+
651653 if c .onUpdate != nil {
652654 c .onUpdate (ctx )
653655 }
@@ -725,9 +727,12 @@ func NewFailoverClusterClient(failoverOpt *FailoverOptions) *ClusterClient {
725727 }
726728
727729 c := NewClusterClient (opt )
730+
731+ failover .mu .Lock ()
728732 failover .onUpdate = func (ctx context.Context ) {
729733 c .ReloadState (ctx )
730734 }
735+ failover .mu .Unlock ()
731736
732737 return c
733738}
You can’t perform that action at this time.
0 commit comments