Commit ffac09da7a1 by Matt Harbison

lfs: avoid quadratic performance in processing server responses

This is also adapted from the Facebook repo[1].  Unlike there, we were already
reading the download stream in chunks and immediately writing it to disk, so we
basically avoided the problem on download.  There shouldn't be a lot of data to
read on upload, but it's better to get rid of this pattern.


Differential Revision:
parent 0ee0a3f6a99
......@@ -503,7 +503,6 @@ class _gitlfsremote(object):
for k, v in headers:
request.add_header(pycompat.strurl(k), pycompat.strurl(v))
response = b''
with contextlib.closing( as res:
contentlength ="content-length")
......@@ -520,11 +519,14 @@ class _gitlfsremote(object):
# blobstore, res, contentlength)
blocks = []
while True:
data =
if not data:
response += data
response = b"".join(blocks)
if response:
ui.debug(b'lfs %s response: %s' % (action, response))
except util.urlerr.httperror as ex:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment