Commit 9fdb3f29 authored by Michael Taufen's avatar Michael Taufen

Stop fd leak in e2e_service.go

Previously this code used http.Get and failed to read/close resp.Body, which prevented network connection reuse, leaking fds. Now we use http.Head instead, because its response always has a nil Body, so we don't have to worry about read/close.
parent 2e989a3c
...@@ -483,7 +483,7 @@ func readinessCheck(urls []string, errCh <-chan error) error { ...@@ -483,7 +483,7 @@ func readinessCheck(urls []string, errCh <-chan error) error {
case <-time.After(time.Second): case <-time.After(time.Second):
ready := true ready := true
for _, url := range urls { for _, url := range urls {
resp, err := http.Get(url) resp, err := http.Head(url)
if err != nil || resp.StatusCode != http.StatusOK { if err != nil || resp.StatusCode != http.StatusOK {
ready = false ready = false
break break
...@@ -580,7 +580,7 @@ func (s *server) start() error { ...@@ -580,7 +580,7 @@ func (s *server) start() error {
return return
case <-time.After(time.Second): case <-time.After(time.Second):
for _, url := range s.healthCheckUrls { for _, url := range s.healthCheckUrls {
resp, err := http.Get(url) resp, err := http.Head(url)
if err != nil || resp.StatusCode != http.StatusOK { if err != nil || resp.StatusCode != http.StatusOK {
break stillAlive break stillAlive
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment