Skip to content
Snippets Groups Projects
Commit 4986d042 authored by Nick Thomas's avatar Nick Thomas
Browse files

Exit with a non-zero error code if communicating with elasticsearch fails

parent 25346fb7
No related branches found
No related tags found
1 merge request!1Initial implementation of an elasticsearch indexer in Go
Loading
Loading
@@ -23,7 +23,6 @@ func main() {
if err != nil {
log.Fatalln("Failed to connect to elasticsearch:", err)
}
defer esClient.Close()
 
projectID := os.Args[1]
projectPath := os.Args[2]
Loading
Loading
@@ -40,4 +39,10 @@ func main() {
log.Printf("Project ID: %s, Rails env: %s", projectID, railsEnv)
 
repo.Index(esClient)
// Flushes any queued requests. Errors mean we've not indexed everything, so
// need to return an error code
if err := esClient.Close(); err != nil {
log.Fatalln("Elasticsearch error: ", err)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment