Smart bufPool

This commit is contained in:
DarthSim
2019-01-30 14:36:19 +06:00
parent 20d6c2778a
commit b8fc6dc9f0
3 changed files with 120 additions and 42 deletions

View File

@@ -124,7 +124,7 @@ func respondWithImage(ctx context.Context, reqID string, r *http.Request, rw htt
addVaryHeader(rw)
if conf.GZipCompression > 0 && strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
buf := responseGzipBufPool.get()
buf := responseGzipBufPool.get(0)
defer responseGzipBufPool.put(buf)
gz := responseGzipPool.get(buf)