mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-18 18:47:55 +08:00
filer, s3, volume server: a bit memory optimization
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/chrislusf/seaweedfs/weed/util/mem"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -368,7 +369,9 @@ func passThroughResponse(proxyResponse *http.Response, w http.ResponseWriter) (s
|
||||
statusCode = proxyResponse.StatusCode
|
||||
}
|
||||
w.WriteHeader(statusCode)
|
||||
if n, err := io.Copy(w, proxyResponse.Body); err != nil {
|
||||
buf := mem.Allocate(128 * 1024)
|
||||
defer mem.Free(buf)
|
||||
if n, err := io.CopyBuffer(w, proxyResponse.Body, buf); err != nil {
|
||||
glog.V(1).Infof("passthrough response read %d bytes: %v", n, err)
|
||||
}
|
||||
return statusCode
|
||||
|
Reference in New Issue
Block a user