Skip to content

Commit

Permalink
Send a ping to make sure the database connection is alive, thanks @pariz
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Aug 1, 2015
1 parent 0def184 commit 6b8f2fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func Open(dialect string, args ...interface{}) (DB, error) {
db: dbSql,
}
db.parent = &db

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

return db, err
Expand Down

0 comments on commit 6b8f2fc

Please sign in to comment.