|
|
@@ -16,7 +16,6 @@ package redis
|
|
|
|
|
|
import (
|
|
|
"bytes"
|
|
|
- "context"
|
|
|
"crypto/rand"
|
|
|
"crypto/sha1"
|
|
|
"errors"
|
|
|
@@ -180,22 +179,6 @@ func (p *Pool) Get() Conn {
|
|
|
return &pooledConnection{p: p, c: c}
|
|
|
}
|
|
|
|
|
|
-// GetContext gets a connection using the provided context.
|
|
|
-//
|
|
|
-// The provided Context must be non-nil. If the context expires before the
|
|
|
-// connection is complete, an error is returned. Any expiration on the context
|
|
|
-// will not affect the returned connection.
|
|
|
-//
|
|
|
-// If the function completes without error, then the application must close the
|
|
|
-// returned connection.
|
|
|
-func (p *Pool) GetContext(ctx context.Context) (Conn, error) {
|
|
|
- c, err := p.get(ctx)
|
|
|
- if err != nil {
|
|
|
- return errorConnection{err}, err
|
|
|
- }
|
|
|
- return &pooledConnection{p: p, c: c}, nil
|
|
|
-}
|
|
|
-
|
|
|
// PoolStats contains pool statistics.
|
|
|
type PoolStats struct {
|
|
|
// ActiveCount is the number of connections in the pool. The count includes
|
|
|
@@ -279,7 +262,10 @@ func (p *Pool) lazyInit() {
|
|
|
|
|
|
// get prunes stale connections and returns a connection from the idle list or
|
|
|
// creates a new connection.
|
|
|
-func (p *Pool) get(ctx context.Context) (Conn, error) {
|
|
|
+func (p *Pool) get(ctx interface {
|
|
|
+ Done() <-chan struct{}
|
|
|
+ Err() error
|
|
|
+}) (Conn, error) {
|
|
|
|
|
|
// Handle limit for p.Wait == true.
|
|
|
if p.Wait && p.MaxActive > 0 {
|