Skip to content

Commit a305dec

Browse files
authored
fix: don't close DB connection after it's established (#49)
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.
1 parent beb7889 commit a305dec

File tree

2 files changed

+0
-2
lines changed

2 files changed

+0
-2
lines changed

mysqltest/docker.go

-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ func tryLogin(conf *config, port string) error {
159159
if err != nil {
160160
return fmt.Errorf("sql.Open(): %w", err)
161161
}
162-
defer db.Close()
163162

164163
if err := db.Ping(); err != nil {
165164
return fmt.Errorf("db.Ping(): %w", err)

mysqltest/docker_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func TestKillAfter(t *testing.T) {
4646
t.Fatal(err)
4747
}
4848
db := connect(t, ci)
49-
defer db.Close()
5049

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

0 commit comments

Comments
 (0)