Merge pull request #1065 from go-redis/fix/inc-stale-conns

Inc StaleConns in ReapStaleConns
This commit is contained in:
Vladimir Mihailenco 2019-06-24 15:47:29 +03:00 committed by GitHub
commit 8558c82c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -428,12 +428,11 @@ func (p *ConnPool) reaper(frequency time.Duration) {
if p.closed() { if p.closed() {
break break
} }
n, err := p.ReapStaleConns() _, err := p.ReapStaleConns()
if err != nil { if err != nil {
internal.Logger.Printf("ReapStaleConns failed: %s", err) internal.Logger.Printf("ReapStaleConns failed: %s", err)
continue continue
} }
atomic.AddUint32(&p.stats.StaleConns, uint32(n))
} }
} }
@ -454,6 +453,7 @@ func (p *ConnPool) ReapStaleConns() (int, error) {
break break
} }
} }
atomic.AddUint32(&p.stats.StaleConns, uint32(n))
return n, nil return n, nil
} }