1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-12 14:21:52 +03:00

Add latency based routing to Redis Cluster client.

This commit is contained in:
Joris Minjat
2016-05-06 11:12:31 -07:00
committed by Vladimir Mihailenco
parent 3972f28066
commit 487feebef1
11 changed files with 760 additions and 509 deletions

View File

@ -52,7 +52,7 @@ func (c *baseClient) putConn(cn *pool.Conn, err error, allowTimeout bool) bool {
func (c *baseClient) initConn(cn *pool.Conn) error {
cn.Inited = true
if c.opt.Password == "" && c.opt.DB == 0 {
if c.opt.Password == "" && c.opt.DB == 0 && !c.opt.ReadOnly {
return nil
}
@ -71,6 +71,12 @@ func (c *baseClient) initConn(cn *pool.Conn) error {
}
}
if c.opt.ReadOnly {
if err := client.ReadOnly().Err(); err != nil {
return err
}
}
return nil
}