diff options
author | Nathan Smith <12156185+nsmith5@users.noreply.github.com> | 2021-04-22 02:54:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 10:54:27 +0100 |
commit | 445e47b6922a5bca9da6d72903398d27562cff98 (patch) | |
tree | a550ed2b7e2896ded224d1397b703f1aa868ff6c /vendor/github.com/unrolled/render/render.go | |
parent | f719ffc783a71a5a23e356d4aa2a52717c022f4b (diff) | |
download | gitea-445e47b6922a5bca9da6d72903398d27562cff98.tar.gz gitea-445e47b6922a5bca9da6d72903398d27562cff98.zip |
Bump unrolled/render to v1.1.0 (#15581)
v1.1.0 has improved buffer pooling
Diffstat (limited to 'vendor/github.com/unrolled/render/render.go')
-rw-r--r-- | vendor/github.com/unrolled/render/render.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/github.com/unrolled/render/render.go b/vendor/github.com/unrolled/render/render.go index 3259f620eb..4cd11cdfcc 100644 --- a/vendor/github.com/unrolled/render/render.go +++ b/vendor/github.com/unrolled/render/render.go @@ -103,6 +103,10 @@ type Options struct { // Enables using partials without the current filename suffix which allows use of the same template in multiple files. e.g {{ partial "carosuel" }} inside the home template will match carosel-home or carosel. // ***NOTE*** - This option should be named RenderPartialsWithoutSuffix as that is what it does. "Prefix" is a typo. Maintaining the existing name for backwards compatibility. RenderPartialsWithoutPrefix bool + + // BufferPool to use when rendering HTML templates. If none is supplied + // defaults to SizedBufferPool of size 32 with 512KiB buffers. + BufferPool GenericBufferPool } // HTMLOptions is a struct for overriding some rendering Options for specific HTML call. @@ -176,6 +180,10 @@ func (r *Render) prepareOptions() { if len(r.opt.XMLContentType) == 0 { r.opt.XMLContentType = ContentXML } + if r.opt.BufferPool == nil { + // 32 buffers of size 512KiB each + r.opt.BufferPool = NewSizedBufferPool(32, 1<<19) + } } func (r *Render) compileTemplates() { @@ -410,6 +418,7 @@ func (r *Render) HTML(w io.Writer, status int, name string, binding interface{}, Head: head, Name: name, Templates: r.templates, + bp: r.opt.BufferPool, } return r.Render(w, h, binding) |