DBWrapper: Test connection in NewDBWrapper()

This commit is contained in:
Noah Hilverling 2019-02-25 10:33:17 +01:00
parent 7bcba36c6e
commit b3afe0385a

View file

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