mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
DBWrapper: Test connection in NewDBWrapper()
This commit is contained in:
parent
7bcba36c6e
commit
b3afe0385a
1 changed files with 5 additions and 0 deletions
5
mysql.go
5
mysql.go
|
|
@ -56,6 +56,11 @@ func NewDBWrapper(dbType string, dbDsn string) (*DBWrapper, error) {
|
|||
dbw := DBWrapper{Db: db, ConnectedAtomic: new(uint32)}
|
||||
dbw.ConnectionUpCondition = sync.NewCond(&sync.Mutex{})
|
||||
|
||||
err = dbw.Db.Ping()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
dbw.checkConnection(true)
|
||||
|
|
|
|||
Loading…
Reference in a new issue