1 parent ca8a616 commit f72e32eCopy full SHA for f72e32e
1 file changed
requester/requester.go
@@ -31,8 +31,10 @@ import (
31
)
32
33
// Max size of the buffer of result channel.
34
-const maxResult = 1000000
35
-const maxIdleConn = 500
+const (
+ maxResult = 1000000
36
+ maxIdleConn = 500
37
+)
38
39
type result struct {
40
err error
@@ -183,11 +185,12 @@ func (b *Work) makeRequest(c *http.Client) {
183
185
}
184
186
req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
187
resp, err := c.Do(req)
188
+ req.Close = true
189
if err == nil {
190
size = resp.ContentLength
191
code = resp.StatusCode
192
io.Copy(ioutil.Discard, resp.Body)
- resp.Body.Close()
193
+ defer resp.Body.Close()
194
195
t := now()
196
resDuration = t - resStart
0 commit comments