mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-02-02 11:34:20 +02:00
Pregrow buffers on Get
This commit is contained in:
parent
250ee7914e
commit
d63f0d5cbe
@ -118,6 +118,10 @@ func (p *bufPool) Get(size int) *bytes.Buffer {
|
||||
|
||||
buf.Reset()
|
||||
|
||||
if size > 0 && size > buf.Cap() {
|
||||
buf.Grow(size)
|
||||
}
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
|
@ -136,10 +136,6 @@ func readAndCheckImage(ctx context.Context, res *http.Response) (context.Context
|
||||
downloadBufPool.Put(buf)
|
||||
}
|
||||
|
||||
if contentLength > buf.Cap() {
|
||||
buf.Grow(contentLength - buf.Len())
|
||||
}
|
||||
|
||||
body := res.Body
|
||||
|
||||
if conf.MaxSrcFileSize > 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user