diff --git a/pubsub.go b/pubsub.go index a5815568..e47978c2 100644 --- a/pubsub.go +++ b/pubsub.go @@ -78,8 +78,15 @@ func (c *PubSub) _conn() (*pool.Conn, bool, error) { if err != nil { return nil, false, err } - c.cn = cn + if !cn.Inited { + if err := c.base.initConn(cn); err != nil { + _ = c.base.connPool.Remove(cn) + return nil, false, err + } + } + + c.cn = cn return cn, true, nil } diff --git a/redis.go b/redis.go index 873d5805..ecf1fc0a 100644 --- a/redis.go +++ b/redis.go @@ -38,6 +38,7 @@ func (c *baseClient) conn() (*pool.Conn, bool, error) { return nil, false, err } } + return cn, isNew, nil }