Merge pull request #2272 from DomParfitt/fix-with-conn-cleanup

Capture error correctly in withConn
This commit is contained in:
Vladimir Mihailenco 2022-11-02 12:07:47 +02:00 committed by GitHub
commit 5350c18740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -288,11 +288,9 @@ func (c *baseClient) withConn(
return err
}
defer func() {
c.releaseConn(ctx, cn, err)
}()
return fn(ctx, cn)
err = fn(ctx, cn)
c.releaseConn(ctx, cn, err)
return err
}
func (c *baseClient) dial(ctx context.Context, network, addr string) (net.Conn, error) {