mysql ping

This commit is contained in:
lwl0608 2023-12-25 01:02:06 +08:00
parent af9678f490
commit eaf9974b55
1 changed files with 5 additions and 0 deletions

View File

@ -95,6 +95,11 @@ func NewMysql(cfg *conf.ConfigSt) (mysql *Mysql, err error) {
mysql.dbVas.SetMaxOpenConns(20)
mysql.dbVas.SetMaxIdleConns(10)
err = mysql.dbVas.Ping()
if err != nil {
logger.Error("MysqlDB ping fail, cfg: %v, db: %v, err: %v", util.ToJson(cfg.MixMongo), DatabaseVas, err)
return
}
return
}