1
0
mirror of https://github.com/redis/go-redis.git synced 2025-08-01 16:06:54 +03:00

Add race test for big vals. Copy connection to avoid race with PubSub.

This commit is contained in:
Vladimir Mihailenco
2016-03-14 13:17:33 +02:00
parent 50b2689809
commit 46790aa060
22 changed files with 257 additions and 148 deletions

View File

@ -54,6 +54,7 @@ func (c *PubSub) subscribe(redisCmd string, channels ...string) error {
if err != nil {
return err
}
c.putConn(cn, err)
args := make([]interface{}, 1+len(channels))
args[0] = redisCmd
@ -306,6 +307,9 @@ func (c *PubSub) putConn(cn *pool.Conn, err error) {
}
func (c *PubSub) resubscribe() {
if c.base.closed() {
return
}
if len(c.channels) > 0 {
if err := c.Subscribe(c.channels...); err != nil {
Logger.Printf("Subscribe failed: %s", err)