forked from mirror/gorm
Merge pull request #1190 from cloudaice/master
fix goroutine leak while calling db.Ping() error
This commit is contained in:
commit
5ec2f6ceb6
3
main.go
3
main.go
|
@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue