Initialize PubSub connection

This commit is contained in:
Vladimir Mihailenco 2017-04-18 13:12:38 +03:00
parent 4fdc3bb9f9
commit 7646d48e29
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 { if err != nil {
return nil, false, err 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 return cn, true, nil
} }

View File

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