From 58c011030e046c1b59d6757461cda44777b7ac0b Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Tue, 24 Jul 2018 12:20:14 +0530 Subject: [PATCH] api: rename connectDB --- api/database_connect.go | 4 ++-- api/main.go | 2 +- api/testing.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/database_connect.go b/api/database_connect.go index d7a011a..3c2eb7d 100644 --- a/api/database_connect.go +++ b/api/database_connect.go @@ -7,7 +7,7 @@ import ( "time" ) -func connectDB(retriesLeft int) error { +func dbConnect(retriesLeft int) error { con := os.Getenv("POSTGRES") logger.Infof("opening connection to postgres: %s", con) @@ -23,7 +23,7 @@ func connectDB(retriesLeft int) error { if retriesLeft > 0 { logger.Errorf("cannot talk to postgres, retrying in 10 seconds (%d attempts left): %v", retriesLeft-1, err) time.Sleep(10 * time.Second) - return connectDB(retriesLeft - 1) + return dbConnect(retriesLeft - 1) } else { logger.Errorf("cannot talk to postgres, last attempt failed: %v", err) return err diff --git a/api/main.go b/api/main.go index a3fde36..8394b8b 100644 --- a/api/main.go +++ b/api/main.go @@ -3,7 +3,7 @@ package main func main() { exitIfError(loggerCreate()) exitIfError(configParse()) - exitIfError(connectDB(5)) + exitIfError(dbConnect(5)) exitIfError(performMigrations()) exitIfError(smtpConfigure()) exitIfError(smtpTemplatesLoad()) diff --git a/api/testing.go b/api/testing.go index 5ad9d2c..7ca3d95 100644 --- a/api/testing.go +++ b/api/testing.go @@ -68,7 +68,7 @@ func setupTestDatabase() error { os.Setenv("POSTGRES", "postgres://postgres:postgres@localhost/commento_test?sslmode=disable") } - if err := connectDB(0); err != nil { + if err := dbConnect(0); err != nil { return err }