Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions internal/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,16 @@ func (p *ConnPool) removeConnWithLock(cn *Conn) {
}

func (p *ConnPool) removeConn(cn *Conn) {
// check idleConns and remove it if present
for i, c := range p.idleConns {
if c == cn {
p.idleConns = append(p.idleConns[:i], p.idleConns[i+1:]...)
p.idleConnsLen--
break
}
}

// then check conns and remove it
for i, c := range p.conns {
if c == cn {
p.conns = append(p.conns[:i], p.conns[i+1:]...)
Expand All @@ -451,6 +461,7 @@ func (p *ConnPool) removeConn(cn *Conn) {
break
}
}

atomic.AddUint32(&p.stats.StaleConns, 1)
}

Expand Down
Loading