From f63170229913b4ad32920391227ab774921272de Mon Sep 17 00:00:00 2001 From: Paul Brackin Date: Sun, 20 Jan 2019 01:30:37 -0800 Subject: [PATCH] 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. --- routers/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/init.go b/routers/init.go index 734aaaa13..4da786cc0 100644 --- a/routers/init.go +++ b/routers/init.go @@ -48,7 +48,7 @@ func initDBEngine() (err error) { log.Info("Beginning ORM engine initialization.") for i := 0; i < setting.DBConnectRetries; i++ { 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 } else if i == setting.DBConnectRetries-1 { return err