@@ -276,10 +276,10 @@ func (p *Pool) TryAcquire(ctx context.Context) (*Resource, error) {
|
||||
// will return ErrNotAvailable if no resource is available.
|
||||
func (p *Pool) doAcquire(ctx context.Context, block bool) (*Resource, error) {
|
||||
startNano := nanotime()
|
||||
p.cond.L.Lock()
|
||||
if doneChan := ctx.Done(); doneChan != nil {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
p.cond.L.Lock()
|
||||
p.canceledAcquireCount += 1
|
||||
p.cond.L.Unlock()
|
||||
return nil, ctx.Err()
|
||||
@@ -287,6 +287,8 @@ func (p *Pool) doAcquire(ctx context.Context, block bool) (*Resource, error) {
|
||||
}
|
||||
}
|
||||
|
||||
p.cond.L.Lock()
|
||||
|
||||
emptyAcquire := false
|
||||
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user