Merge pull request #1190 from cloudaice/master

fix goroutine leak while calling db.Ping() error
This commit is contained in:
Jinzhu 2016-09-25 14:26:37 +08:00 committed by GitHub
commit 5ec2f6ceb6
1 changed files with 3 additions and 0 deletions

View File

@ -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()
}
}
}