Make 'object save' fast again

'openstack object save' is critically slow to download big objects. While
we 'stream' (chunked download) the data, the default chunks_size
is 1 byte [1], which is terribly inefficient.

[1] : http://docs.python-requests.org/en/master/api/#requests.Response.iter_content

Closes-Bug: 1654645


Change-Id: I2223e5897346acd2f2c1fae638d1193cff833c19
This commit is contained in:
Jordan Pittier 2017-01-09 15:40:59 +01:00 committed by Steve Martinelli
parent 1957690754
commit 1cdc1319d6
2 changed files with 6 additions and 1 deletions

View File

@ -380,7 +380,7 @@ class APIv1(api.BaseAPI):
if len(os.path.dirname(file)) > 0:
os.makedirs(os.path.dirname(file))
with open(file, 'wb') as f:
for chunk in response.iter_content():
for chunk in response.iter_content(64 * 1024):
f.write(chunk)
def object_set(

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Makes ``openstack object save`` much faster when saving an object to disk.
[Bug `1654645 <https://bugs.launchpad.net/bugs/1654645>`_]