mirror of https://github.com/k3s-io/k3s
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.pull/6/head
parent
2e989a3c38
commit
9fdb3f291a
|
@ -483,7 +483,7 @@ func readinessCheck(urls []string, errCh <-chan error) error {
|
|||
case <-time.After(time.Second):
|
||||
ready := true
|
||||
for _, url := range urls {
|
||||
resp, err := http.Get(url)
|
||||
resp, err := http.Head(url)
|
||||
if err != nil || resp.StatusCode != http.StatusOK {
|
||||
ready = false
|
||||
break
|
||||
|
@ -580,7 +580,7 @@ func (s *server) start() error {
|
|||
return
|
||||
case <-time.After(time.Second):
|
||||
for _, url := range s.healthCheckUrls {
|
||||
resp, err := http.Get(url)
|
||||
resp, err := http.Head(url)
|
||||
if err != nil || resp.StatusCode != http.StatusOK {
|
||||
break stillAlive
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue