Skip to content

Commit

Permalink
fix(otelsql): the connection to db must be closed after receiving the…
Browse files Browse the repository at this point in the history
… driver
  • Loading branch information
a.juraev committed Sep 20, 2023
1 parent f0259e1 commit 39a2b46
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions otelsql/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ func Open(driverName, dsn string, opts ...Option) (*sql.DB, error) {

func patchDB(db *sql.DB, dsn string, opts ...Option) (*sql.DB, error) {
dbDriver := db.Driver()

err := db.Close()
if err != nil {
return nil, err
}

d := newDriver(dbDriver, opts)

if _, ok := dbDriver.(driver.DriverContext); ok {
Expand Down

0 comments on commit 39a2b46

Please sign in to comment.