diff options
author | Julia Kreger <juliaashleykreger@gmail.com> | 2020-06-24 10:02:28 -0700 |
---|---|---|
committer | Julia Kreger <juliaashleykreger@gmail.com> | 2020-06-24 10:02:28 -0700 |
commit | 7abda4eefe2b3aa5045987933de93fe8e05739e4 (patch) | |
tree | 14ee32fcd9482b6ae6c6993939cc3305dc89f639 /ironic_python_agent | |
parent | c5b97eb781cf9851f9abe87a1500b4da55b8bde8 (diff) | |
download | ironic-python-agent-7abda4eefe2b3aa5045987933de93fe8e05739e4.tar.gz |
Minor clean-up follow-up to timeout on read() fix
Just some minor cleanup driven from the review process.
Change-Id: I0b3d73c251d6da6d85e11279990dcc36751e27e7
Diffstat (limited to 'ironic_python_agent')
-rw-r--r-- | ironic_python_agent/extensions/standby.py | 2 | ||||
-rw-r--r-- | ironic_python_agent/tests/unit/extensions/test_standby.py | 9 |
2 files changed, 3 insertions, 8 deletions
diff --git a/ironic_python_agent/extensions/standby.py b/ironic_python_agent/extensions/standby.py index 0a408390..daba9607 100644 --- a/ironic_python_agent/extensions/standby.py +++ b/ironic_python_agent/extensions/standby.py @@ -282,7 +282,6 @@ class ImageDownload(object): any reason. """ self._time = time_obj or time.time() - self._last_chunk_time = None self._image_info = image_info self._request = None @@ -344,6 +343,7 @@ class ImageDownload(object): :returns: A chunk of the image. Size of chunk is IMAGE_CHUNK_SIZE which is a constant in this module. """ + self._last_chunk_time = None for chunk in self._request.iter_content(IMAGE_CHUNK_SIZE): # Per requests forum posts/discussions, iter_content should # periodically yield to the caller for the client to do things diff --git a/ironic_python_agent/tests/unit/extensions/test_standby.py b/ironic_python_agent/tests/unit/extensions/test_standby.py index 5f88ffa8..0d8c8ffa 100644 --- a/ironic_python_agent/tests/unit/extensions/test_standby.py +++ b/ironic_python_agent/tests/unit/extensions/test_standby.py @@ -1217,7 +1217,6 @@ class TestStandbyExtension(base.IronicAgentTest): status_code = 200 def __init__(self, url, stream, proxies, verify, cert, timeout): - time.sleep(1) self.count = 0 def __iter__(self): @@ -1227,12 +1226,8 @@ class TestStandbyExtension(base.IronicAgentTest): if self.count == 1: time.sleep(4) return None - if self.count < 3: - self.count += 1 - return "meow" - else: - time.sleep(30) - raise StopIteration + self.count += 1 + return "meow" def iter_content(self, chunk_size): return self |