free turn when leave with error (#2658)

Co-authored-by: ofekshenawa <104765379+ofekshenawa@users.noreply.github.com>
This commit is contained in:
cyningsun 2023-10-30 23:42:26 +08:00 committed by GitHub
parent 7ebb537c80
commit 4408f8cfb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -263,6 +263,7 @@ func (p *ConnPool) Get(ctx context.Context) (*Conn, error) {
p.connsMu.Unlock() p.connsMu.Unlock()
if err != nil { if err != nil {
p.freeTurn()
return nil, err return nil, err
} }