Skip to content

Commit

Permalink
Make http healthcheck async
Browse files Browse the repository at this point in the history
  • Loading branch information
mishan committed Nov 16, 2016
1 parent 6b3c7ad commit 101a8a1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions red53_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,13 @@ func main() {
sum += 2
}

http.HandleFunc("/healthcheck", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "OK")
})
go func() {
http.HandleFunc("/healthcheck", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "OK")
})

log.Fatal(http.ListenAndServe(":8080", nil))
log.Fatal(http.ListenAndServe(":8080", nil))
}()

// check regularly, specified by checkInterval
ticker := time.NewTicker(checkInterval)
Expand Down

0 comments on commit 101a8a1

Please sign in to comment.