Ensure error is logged on db reconnection attempts (#5780)
Unfortunately a scoping problem was missed on the previous PR which meant that the only nil error was logged on failure to connect to the db. This pr fixes this.release/v1.15
parent
dbb4aeead9
commit
f631702299
|
@ -48,7 +48,7 @@ func initDBEngine() (err error) {
|
||||||
log.Info("Beginning ORM engine initialization.")
|
log.Info("Beginning ORM engine initialization.")
|
||||||
for i := 0; i < setting.DBConnectRetries; i++ {
|
for i := 0; i < setting.DBConnectRetries; i++ {
|
||||||
log.Info("ORM engine initialization attempt #%d/%d...", i+1, setting.DBConnectRetries)
|
log.Info("ORM engine initialization attempt #%d/%d...", i+1, setting.DBConnectRetries)
|
||||||
if err := models.NewEngine(migrations.Migrate); err == nil {
|
if err = models.NewEngine(migrations.Migrate); err == nil {
|
||||||
break
|
break
|
||||||
} else if i == setting.DBConnectRetries-1 {
|
} else if i == setting.DBConnectRetries-1 {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue