MCPcopy
hub / github.com/redis/go-redis / removeConnWithLock

Method removeConnWithLock

internal/pool/pool.go:1500–1504  ·  view source on GitHub ↗

removeConnWithLock removes a connection from the pool under the connsMu lock. Returns true if the connection was actually present in p.conns and was removed, false if it was already gone (e.g., removed by Close()). Callers must use the return value to decide whether to emit metric decrements — this

(cn *Conn)

Source from the content-addressed store, hash-verified

1498// return value to decide whether to emit metric decrements — this eliminates the
1499// shutdown race between Close() and concurrent removal paths.
1500func (p *ConnPool) removeConnWithLock(cn *Conn) bool {
1501 p.connsMu.Lock()
1502 defer p.connsMu.Unlock()
1503 return p.removeConn(cn)
1504}
1505
1506// removeConn removes a connection from the pool's internal data structures.
1507// Returns true if the connection was present and removed, false otherwise.

Callers 3

putConnMethod · 0.95
removeConnInternalMethod · 0.95
CloseConnMethod · 0.95

Calls 1

removeConnMethod · 0.95

Tested by

no test coverage detected