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-08-18 17:03:32 +03:00
parent e471faf7f8
commit e694ed0084
3 changed files with 7 additions and 7 deletions

View File

@ -58,20 +58,20 @@ func (p *SingleConnPool) SetConn(cn *Conn) {
}
}
func (p *SingleConnPool) NewConn(c context.Context) (*Conn, error) {
return p.pool.NewConn(c)
func (p *SingleConnPool) NewConn(ctx context.Context) (*Conn, error) {
return p.pool.NewConn(ctx)
}
func (p *SingleConnPool) CloseConn(cn *Conn) error {
return p.pool.CloseConn(cn)
}
func (p *SingleConnPool) Get(c context.Context) (*Conn, error) {
func (p *SingleConnPool) Get(ctx context.Context) (*Conn, error) {
// In worst case this races with Close which is not a very common operation.
for i := 0; i < 1000; i++ {
switch atomic.LoadUint32(&p.state) {
case stateDefault:
cn, err := p.pool.Get(c)
cn, err := p.pool.Get(ctx)
if err != nil {
return nil, err
}