api: rename connectDB
This commit is contained in:
parent
645fad6139
commit
58c011030e
@ -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
|
||||
|
@ -3,7 +3,7 @@ package main
|
||||
func main() {
|
||||
exitIfError(loggerCreate())
|
||||
exitIfError(configParse())
|
||||
exitIfError(connectDB(5))
|
||||
exitIfError(dbConnect(5))
|
||||
exitIfError(performMigrations())
|
||||
exitIfError(smtpConfigure())
|
||||
exitIfError(smtpTemplatesLoad())
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user