Skip to content

Commit

Permalink
fix: don't close DB connection after it's established (#49)
Browse files Browse the repository at this point in the history
The docs for DB.Close() specfically say not to do this. These
connections should be long-lived. This bug may be causing problems with
connection pooling, causing clients to get "bad connection" errors.
  • Loading branch information
drevell authored Dec 23, 2022
1 parent beb7889 commit a305dec
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 2 deletions.
1 change: 0 additions & 1 deletion mysqltest/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ func tryLogin(conf *config, port string) error {
if err != nil {
return fmt.Errorf("sql.Open(): %w", err)
}
defer db.Close()

if err := db.Ping(); err != nil {
return fmt.Errorf("db.Ping(): %w", err)
Expand Down
1 change: 0 additions & 1 deletion mysqltest/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestKillAfter(t *testing.T) {
t.Fatal(err)
}
db := connect(t, ci)
defer db.Close()

if err := db.Ping(); err != nil {
t.Fatalf("db.Ping: %v", err)
Expand Down

0 comments on commit a305dec

Please sign in to comment.