PYTHON-3502 GridFSBucket.download_to_stream slow (#1108)
This commit is contained in:
parent
04356b0ffd
commit
a00aabfa0d
@ -1,6 +1,14 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Changes in Version 4.3.3
|
||||
------------------------
|
||||
|
||||
- Fixed a performance regression in :meth:`~gridfs.GridOut.download_to_stream`
|
||||
and :meth:`~gridfs.GridOut.download_to_stream_by_name` by reading in chunks
|
||||
instead of line by line.
|
||||
|
||||
|
||||
Changes in Version 4.3 (4.3.2)
|
||||
------------------------------
|
||||
|
||||
|
||||
@ -796,7 +796,10 @@ class GridFSBucket(object):
|
||||
Added ``session`` parameter.
|
||||
"""
|
||||
with self.open_download_stream(file_id, session=session) as gout:
|
||||
for chunk in gout:
|
||||
while True:
|
||||
chunk = gout.readchunk()
|
||||
if not len(chunk):
|
||||
break
|
||||
destination.write(chunk)
|
||||
|
||||
@_csot.apply
|
||||
@ -977,7 +980,10 @@ class GridFSBucket(object):
|
||||
Added ``session`` parameter.
|
||||
"""
|
||||
with self.open_download_stream_by_name(filename, revision, session=session) as gout:
|
||||
for chunk in gout:
|
||||
while True:
|
||||
chunk = gout.readchunk()
|
||||
if not len(chunk):
|
||||
break
|
||||
destination.write(chunk)
|
||||
|
||||
def rename(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user