Skip to content

Commit

Permalink
do not prevent keepalive, drain the discareded response body
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Ammons committed Apr 21, 2016
1 parent 5302e9c commit 855a4e3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ func (c *Client) pester(p params) (*http.Response, error) {
resultCh <- res
} else if res.resp != nil {
// we only return one result to the caller; close all other response bodies that come back
// drain the body before close as to not prevent keepalive. see https://gist.github.com/mholt/eba0f2cc96658be0f717
io.Copy(ioutil.Discard, res.resp.Body)
res.resp.Body.Close()
}
}
Expand Down

0 comments on commit 855a4e3

Please sign in to comment.