Skip to content

Commit

Permalink
fix: capture error correctly in withConn
Browse files Browse the repository at this point in the history
  • Loading branch information
DomParfitt authored and greedy52 committed Nov 8, 2022
1 parent ed9116f commit d5ec4a6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,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) {
Expand Down

0 comments on commit d5ec4a6

Please sign in to comment.