# HG changeset patch # User Marcin Kuzminski # Date 2017-04-18 07:25:37 # Node ID 12e8c50af74e225c935ef01e3adcefea236eb084 # Parent 39019410511cc8cf4f1fef11731b1498b6d1b4c1 git-lfs: make usage of gunicorn wrappers to write data to disk. - instead of turning it into a seekable object we write the data directly from gunicorn Body object. This has consistent behaviour on chunked vs non chunked data. diff --git a/vcsserver/git_lfs/app.py b/vcsserver/git_lfs/app.py --- a/vcsserver/git_lfs/app.py +++ b/vcsserver/git_lfs/app.py @@ -149,8 +149,18 @@ def lfs_objects_oid_upload(request): oid, repo, store_location=request.registry.git_lfs_store_path) engine = store.get_engine(mode='wb') log.debug('LFS: starting chunked write of LFS oid: %s to storage', oid) + + body = request.environ['wsgi.input'] + with engine as f: - for chunk in FileWrapper(request.body_file_seekable, blksize=64 * 1024): + blksize = 64 * 1024 # 64kb + while True: + # read in chunks as stream comes in from Gunicorn + # this is a specific Gunicorn support function. + # might work differently on waitress + chunk = body.read(blksize) + if not chunk: + break f.write(chunk) return {'upload': 'ok'}