Handle asyncio timeouts. Ref #1307.

This commit is contained in:
grossmj committed 2018-04-28 17:42:02 +07:00
1 parent a56d5b453f
commit 305fe2e817
6 files changed
+40 -21

No files matched your search

+5 -1
View File
@@ -198,7 +198,7 @@ class Docker(BaseManager):
pass
if progress_callback:
progress_callback("Pull {} from docker hub".format(image))
progress_callback("Pulling '{}' from docker hub".format(image))
response = yield from self.http_query("POST", "images/create", params={"fromImage": image}, timeout=None)
# The pull api will stream status via an HTTP JSON stream
content = ""
@@ -206,6 +206,10 @@ class Docker(BaseManager):
try:
chunk = yield from response.content.read(1024)
except aiohttp.ServerDisconnectedError:
log.error("Disconnected from server while pulling Docker image '{}' from docker hub".format(image))
break
except asyncio.TimeoutError:
log.error("Timeout while pulling Docker image '{}' from docker hub".format(image))
break
if not chunk:
break