From 7646d48e29f22789b6a541c3bce5f5f0c97f368b Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Tue, 18 Apr 2017 13:12:38 +0300 Subject: [PATCH] Initialize PubSub connection --- pubsub.go | 9 ++++++++- redis.go | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) 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 }