fix goroutine leak while calling db.Ping() error

This commit is contained in:
cloudaice 2016-09-18 14:26:16 +08:00
parent 041cd3dd31
commit 7dcd80ddf9

View File

@ -75,6 +75,9 @@ func Open(dialect string, args ...interface{}) (*DB, error) {
if err == nil { if err == nil {
err = db.DB().Ping() // Send a ping to make sure the database connection is alive. err = db.DB().Ping() // Send a ping to make sure the database connection is alive.
if err != nil {
db.DB().Close()
}
} }
} }