Merge pull request #8681 from McSinyx/faster-deps

[fast-deps] Make range requests closer to chunk size
This commit is contained in:
Pradyun Gedam 2020-08-04 07:38:48 +05:30 committed by GitHub
commit e7357c71cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -109,8 +109,10 @@ class LazyZipOverHTTP(object):
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)