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 {
177
177
opt .init ()
178
178
179
179
connPool := newConnPool (opt )
180
+
180
181
failover .mu .Lock ()
181
182
failover .onFailover = func (ctx context.Context , addr string ) {
182
183
_ = connPool .Filter (func (cn * pool.Conn ) bool {
@@ -648,6 +649,7 @@ func (c *sentinelFailover) discoverSentinels(ctx context.Context) {
648
649
649
650
func (c * sentinelFailover ) listen (pubsub * PubSub ) {
650
651
ctx := context .TODO ()
652
+
651
653
if c .onUpdate != nil {
652
654
c .onUpdate (ctx )
653
655
}
@@ -725,9 +727,12 @@ func NewFailoverClusterClient(failoverOpt *FailoverOptions) *ClusterClient {
725
727
}
726
728
727
729
c := NewClusterClient (opt )
730
+
731
+ failover .mu .Lock ()
728
732
failover .onUpdate = func (ctx context.Context ) {
729
733
c .ReloadState (ctx )
730
734
}
735
+ failover .mu .Unlock ()
731
736
732
737
return c
733
738
}
You can’t perform that action at this time.
0 commit comments