Skip to content

Commit d79dcec

Browse files
committed
pubsub to work with new conn
1 parent 3570c1a commit d79dcec

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

redis.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,9 +991,19 @@ func (c *Client) TxPipeline() Pipeliner {
991991
func (c *Client) pubSub() *PubSub {
992992
pubsub := &PubSub{
993993
opt: c.opt,
994-
995994
newConn: func(ctx context.Context, channels []string) (*pool.Conn, error) {
996-
return c.connPool.GetPubSub(ctx)
995+
cn, err := c.connPool.GetPubSub(ctx)
996+
if err != nil {
997+
return nil, err
998+
}
999+
1000+
err = c.initConn(ctx, cn)
1001+
if err != nil {
1002+
_ = c.connPool.CloseConn(cn)
1003+
return nil, err
1004+
}
1005+
1006+
return cn, nil
9971007
},
9981008
closeConn: c.connPool.CloseConn,
9991009
pushProcessor: c.pushProcessor,

0 commit comments

Comments
 (0)