Skip to content

Commit

Permalink
fix goroutine leak while calling db.Ping() error
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudaice committed Sep 18, 2016
1 parent 041cd3d commit 7dcd80d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func Open(dialect string, args ...interface{}) (*DB, error) {

if err == nil {
err = db.DB().Ping() // Send a ping to make sure the database connection is alive.
if err != nil {
db.DB().Close()
}
}
}

Expand Down

0 comments on commit 7dcd80d

Please sign in to comment.