summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Pittier <jordan.pittier@scality.com>2017-01-09 15:40:59 +0100
committerSteve Martinelli <s.martinelli@gmail.com>2017-01-09 16:19:29 +0000
commit1cdc1319d6cbfc4087551e5bf0a9875c016eca1c (patch)
tree736e143846fb1a276456d06dbfdd8c9cf4d92393
parent1957690754961aed8bf9c7894e3ab140a9f2c0b9 (diff)
downloadpython-openstackclient-1cdc1319d6cbfc4087551e5bf0a9875c016eca1c.tar.gz
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
-rw-r--r--openstackclient/api/object_store_v1.py2
-rw-r--r--releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml5
2 files changed, 6 insertions, 1 deletions
diff --git a/openstackclient/api/object_store_v1.py b/openstackclient/api/object_store_v1.py
index 184814c6..74c4a46f 100644
--- a/openstackclient/api/object_store_v1.py
+++ b/openstackclient/api/object_store_v1.py
@@ -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(
diff --git a/releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml b/releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml
new file mode 100644
index 00000000..b7ad0940
--- /dev/null
+++ b/releasenotes/notes/speedup-object-save-6bd59e678a31c3e8.yaml
@@ -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>`_]