Merge pull request #551 from go-redis/fix/init-pubsub

Initialize PubSub connection
This commit is contained in:
Vladimir Mihailenco 2017-04-18 13:21:38 +03:00 committed by GitHub
commit 15786cf821
2 changed files with 9 additions and 1 deletions

View File

@ -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
}

View File

@ -38,6 +38,7 @@ func (c *baseClient) conn() (*pool.Conn, bool, error) {
return nil, false, err
}
}
return cn, isNew, nil
}