summaryrefslogtreecommitdiffstats
path: root/routers/repo/download.go
diff options
context:
space:
mode:
authorDuncan Ogilvie <mr.exodia.tpodt@gmail.com>2017-11-29 02:50:39 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2017-11-29 09:50:39 +0800
commit551f3cbe420dcb72bcb784205451d5b01b811041 (patch)
tree612c505d8f46972a598e1ca118cba45c775f329d /routers/repo/download.go
parent4035ab05fa2d2c8ec95d346fea91cab8211dab17 (diff)
downloadgitea-551f3cbe420dcb72bcb784205451d5b01b811041.tar.gz
gitea-551f3cbe420dcb72bcb784205451d5b01b811041.zip
Memory usage improvements (#3013)
* govendor update code.gitea.io/git Signed-off-by: Duncan Ogilvie <mr.exodia.tpodt@gmail.com> * Greatly improve memory usage Signed-off-by: Duncan Ogilvie <mr.exodia.tpodt@gmail.com>
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r--routers/repo/download.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index 78c6088607..78c4b519be 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -45,10 +45,11 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
// ServeBlob download a git.Blob
func ServeBlob(ctx *context.Context, blob *git.Blob) error {
- dataRc, err := blob.Data()
+ dataRc, err := blob.DataAsync()
if err != nil {
return err
}
+ defer dataRc.Close()
return ServeData(ctx, ctx.Repo.TreePath, dataRc)
}