diff options
author | 2020-04-19 23:39:21 +0200 | |
---|---|---|
committer | 2020-04-19 23:39:21 +0200 | |
commit | c565820bca743186084e9384703bcd202e570b66 (patch) | |
tree | 6eb5c738a0e08432231709b77f9b5cb979eac489 | |
parent | docker-compose: Change the name of the postgress pass variable (diff) | |
download | glsamaker-c565820bca743186084e9384703bcd202e570b66.tar.gz glsamaker-c565820bca743186084e9384703bcd202e570b66.tar.bz2 glsamaker-c565820bca743186084e9384703bcd202e570b66.zip |
Fix the initial startup
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r-- | glsamaker.go | 9 |
1 files 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) } |