1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

ConnPool check fd for bad conns (#1824)

* conncheck for badconn (#1821)

* format imports

* fix ut: pool with badconn

* fix unstable ut: should facilitate failover

* Revert "fix unstable ut: should facilitate failover"

This reverts commit c7eeca2a5c.

* fix test error

Signed-off-by: monkey92t <golang@88.com>

Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: monkey92t <golang@88.com>
This commit is contained in:
do it
2021-07-20 17:23:48 +08:00
committed by GitHub
parent 62fc2c821b
commit 346bfafddd
10 changed files with 204 additions and 18 deletions

View File

@ -520,7 +520,7 @@ func (p *ConnPool) reapStaleConn() *Conn {
func (p *ConnPool) isStaleConn(cn *Conn) bool {
if p.opt.IdleTimeout == 0 && p.opt.MaxConnAge == 0 {
return false
return connCheck(cn.netConn) != nil
}
now := time.Now()
@ -531,5 +531,5 @@ func (p *ConnPool) isStaleConn(cn *Conn) bool {
return true
}
return false
return connCheck(cn.netConn) != nil
}