mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Add race test for big vals. Copy connection to avoid race with PubSub.
This commit is contained in:
14
redis.go
14
redis.go
@ -45,17 +45,11 @@ func (c *baseClient) conn() (*pool.Conn, bool, error) {
|
||||
|
||||
func (c *baseClient) putConn(cn *pool.Conn, err error, allowTimeout bool) bool {
|
||||
if isBadConn(err, allowTimeout) {
|
||||
err = c.connPool.Replace(cn, err)
|
||||
if err != nil {
|
||||
Logger.Printf("pool.Remove failed: %s", err)
|
||||
}
|
||||
_ = c.connPool.Replace(cn, err)
|
||||
return false
|
||||
}
|
||||
|
||||
err = c.connPool.Put(cn)
|
||||
if err != nil {
|
||||
Logger.Printf("pool.Put failed: %s", err)
|
||||
}
|
||||
_ = c.connPool.Put(cn)
|
||||
return true
|
||||
}
|
||||
|
||||
@ -121,6 +115,10 @@ func (c *baseClient) process(cmd Cmder) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *baseClient) closed() bool {
|
||||
return c.connPool.Closed()
|
||||
}
|
||||
|
||||
// Close closes the client, releasing any open resources.
|
||||
//
|
||||
// It is rare to Close a Client, as the Client is meant to be
|
||||
|
Reference in New Issue
Block a user