diff --git a/pubsub.go b/pubsub.go index a581556..e47978c 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 873d580..ecf1fc0 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 }