From c565820bca743186084e9384703bcd202e570b66 Mon Sep 17 00:00:00 2001 From: Max Magorsch Date: Sun, 19 Apr 2020 23:39:21 +0200 Subject: Fix the initial startup Signed-off-by: Max Magorsch --- glsamaker.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/glsamaker.go b/glsamaker.go index 5c7f6ec..a4caa8f 100644 --- a/glsamaker.go +++ b/glsamaker.go @@ -25,17 +25,18 @@ func isCommand(command string) bool { func main() { - waitForPostgres() - errorLogFile := logger.CreateLogFile(config.LogFile()) defer errorLogFile.Close() initLoggers(os.Stdout, errorLogFile) if isCommand("--serve") { + waitForPostgres(10) app.Serve() } else if isCommand("--full-update") { + waitForPostgres(5) cveimport.FullUpdate() } else if isCommand("--update") { + waitForPostgres(7) cveimport.Update() } else { printHelp() @@ -55,6 +56,6 @@ func initLoggers(infoHandler io.Writer, errorHandler io.Writer) { // TODO this has to be solved differently // wait for postgres to come up -func waitForPostgres() { - time.Sleep(5 * time.Second) +func waitForPostgres(seconds int) { + time.Sleep(time.Duration(seconds) * time.Second) } -- cgit v1.2.3-65-gdbad