Skip to content

Commit

Permalink
[fast-deps] Make range requests closer to chunk size
Browse files Browse the repository at this point in the history
  • Loading branch information
McSinyx committed Aug 3, 2020
1 parent 89d8cba commit d98ff19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Empty file.
4 changes: 3 additions & 1 deletion src/pip/_internal/network/lazy_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ def read(self, size=-1):
all bytes until EOF are returned. Fewer than
size bytes may be returned if EOF is reached.
"""
download_size = max(size, self._chunk_size)
start, length = self.tell(), self._length
stop = start + size if 0 <= size <= length-start else length
stop = length if size < 0 else min(start+download_size, length)
start = max(0, stop-download_size)
self._download(start, stop-1)
return self._file.read(size)

Expand Down

0 comments on commit d98ff19

Please sign in to comment.