Skip to content

Commit

Permalink
avoid excessive spinning when context canceled & waiting on contexts …
Browse files Browse the repository at this point in the history
…channel to close
  • Loading branch information
serprex committed Feb 21, 2025
1 parent f830d50 commit 52d1f17
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ func (ci connInfo) Connect(ctx context.Context) (sqldriver.Conn, error) {
var ok bool
select {
case <-ctx.Done():
ctx = context.Background()
_ = c.Conn.Close()
case ctx, ok = <-contexts:
if !ok {
Expand Down

0 comments on commit 52d1f17

Please sign in to comment.