1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00
This commit is contained in:
Vladimir Mihailenco
2019-06-14 16:00:03 +03:00
parent c0e70ad31d
commit 880e05d975
7 changed files with 15 additions and 22 deletions

View File

@ -34,7 +34,7 @@ type Stats struct {
}
type Pooler interface {
NewConn() (*Conn, error)
NewConn(context.Context) (*Conn, error)
CloseConn(*Conn) error
Get(context.Context) (*Conn, error)
@ -115,7 +115,7 @@ func (p *ConnPool) checkMinIdleConns() {
}
func (p *ConnPool) addIdleConn() {
cn, err := p.newConn(nil, true)
cn, err := p.newConn(context.TODO(), true)
if err != nil {
return
}
@ -126,8 +126,8 @@ func (p *ConnPool) addIdleConn() {
p.connsMu.Unlock()
}
func (p *ConnPool) NewConn() (*Conn, error) {
return p._NewConn(nil, false)
func (p *ConnPool) NewConn(ctx context.Context) (*Conn, error) {
return p._NewConn(ctx, false)
}
func (p *ConnPool) _NewConn(ctx context.Context, pooled bool) (*Conn, error) {