Files
cyningsunandGitHub 1bf873ed6a feat(pool): add ConnMaxLifetimeJitter to prevent connection thundering herd (#3666)
* add connection max lifetime jitter

* refactor calcConnExpiresAt
2026-01-15 17:01:41 +02:00

31 lines
463 B
Go

package pool
import (
"net"
"time"
)
func (cn *Conn) SetCreatedAt(tm time.Time) {
cn.createdAt = tm
}
func (cn *Conn) NetConn() net.Conn {
return cn.getNetConn()
}
func (p *ConnPool) CheckMinIdleConns() {
p.connsMu.Lock()
p.checkMinIdleConns()
p.connsMu.Unlock()
}
func (p *ConnPool) QueueLen() int {
return int(p.semaphore.Len())
}
var NoExpiration = noExpiration
func (p *ConnPool) CalcConnExpiresAt() time.Time {
return p.calcConnExpiresAt()
}