mirror of
https://github.com/minio/minio.git
synced 2026-11-19 23:03:17 +00:00
Drain response body properly for http connection pool (#6415)
Currently Go http connection pool was not being properly utilized leading to degrading performance as the number of concurrent requests increased. As recommended by Go implementation, we have to drain the response body and close it.
This commit is contained in:
1 parent
1961f2ef54
commit
fd1b8491db
9 files changed
+82
-17
No files matched your search
@@ -20,6 +20,8 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -54,6 +56,8 @@ func (h *HTTPTarget) startHTTPLogger() {
|
||||
continue
|
||||
}
|
||||
if resp.Body != nil {
|
||||
buf := make([]byte, 512)
|
||||
io.CopyBuffer(ioutil.Discard, resp.Body, buf)
|
||||
resp.Body.Close()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user