mirror of
https://github.com/coaidev/coai.git
synced 2025-05-28 09:20:18 +09:00
fix db connection in docker compose
This commit is contained in:
parent
823025eddd
commit
456b4e0c01
@ -31,7 +31,11 @@ func ConnectMySQL() *sql.DB {
|
||||
))
|
||||
if err != nil || db.Ping() != nil {
|
||||
log.Println(fmt.Sprintf("[connection] failed to connect to mysql server: %s, will retry in 5 seconds", viper.GetString("mysql.host")))
|
||||
return nil
|
||||
|
||||
utils.Sleep(5)
|
||||
db.Close()
|
||||
|
||||
return ConnectMySQL()
|
||||
} else {
|
||||
log.Println(fmt.Sprintf("[connection] connected to mysql server (host: %s)", viper.GetString("mysql.host")))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user