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

PubSub conns don't share connection pool limit

This commit is contained in:
Vladimir Mihailenco
2017-04-17 15:43:58 +03:00
parent aeb22d6a37
commit 6499563e07
14 changed files with 180 additions and 153 deletions

View File

@ -31,9 +31,10 @@ func (c *baseClient) conn() (*pool.Conn, bool, error) {
if err != nil {
return nil, false, err
}
if !cn.Inited {
if err := c.initConn(cn); err != nil {
_ = c.connPool.Remove(cn, err)
_ = c.connPool.Remove(cn)
return nil, false, err
}
}
@ -42,7 +43,7 @@ func (c *baseClient) conn() (*pool.Conn, bool, error) {
func (c *baseClient) putConn(cn *pool.Conn, err error, allowTimeout bool) bool {
if internal.IsBadConn(err, allowTimeout) {
_ = c.connPool.Remove(cn, err)
_ = c.connPool.Remove(cn)
return false
}
@ -353,7 +354,7 @@ func (c *Client) pubSub() *PubSub {
return &PubSub{
base: baseClient{
opt: c.opt,
connPool: pool.NewStickyConnPool(c.connPool.(*pool.ConnPool), false),
connPool: c.connPool,
},
}
}