1
0
mirror of https://github.com/redis/go-redis.git synced 2025-08-08 23:42:06 +03:00

fix: late binding for dial hook

This commit is contained in:
Vladimir Mihailenco
2022-10-12 15:00:06 +03:00
parent 180f107add
commit 2ec03d9b37
5 changed files with 51 additions and 50 deletions

View File

@@ -205,10 +205,11 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
opt: opt,
},
}
connPool = newConnPool(opt, rdb.baseClient.dial)
rdb.init()
connPool = newConnPool(opt, rdb.hooks.dial)
rdb.connPool = connPool
rdb.onClose = failover.Close
rdb.init()
failover.mu.Lock()
failover.onFailover = func(ctx context.Context, addr string) {
@@ -269,10 +270,10 @@ func NewSentinelClient(opt *Options) *SentinelClient {
opt: opt,
},
}
c.connPool = newConnPool(opt, c.baseClient.dial)
c.hooks.setDial(c.baseClient.dial)
c.hooks.setProcess(c.baseClient.process)
c.connPool = newConnPool(opt, c.hooks.dial)
return c
}