From 5f27a073ba2d1bb95c8d3fcef687362c7018de0b Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 24 Jun 2015 06:48:57 -0700 Subject: [PATCH] Bump amount of file to download in a chunk to 64k. --- lib/ansible/modules/files/unarchive.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/files/unarchive.py b/lib/ansible/modules/files/unarchive.py index 647c218460e..8053991b63d 100644 --- a/lib/ansible/modules/files/unarchive.py +++ b/lib/ansible/modules/files/unarchive.py @@ -94,6 +94,9 @@ from zipfile import ZipFile # String from tar that shows the tar contents are different from the # filesystem DIFFERENCE_RE = re.compile(r': (.*) differs$') +# When downloading an archive, how much of the archive to download before +# saving to a tempfile (64k) +BUFSIZE = 65536 class UnarchiveError(Exception): pass @@ -282,7 +285,7 @@ def main(): f = open(package, 'w') # Read 1kb at a time to save on ram while True: - data = rsp.read(1024) + data = rsp.read(BUFSIZE) if data == "": break # End of file, break while loop