update_manager: wrap calls to http.fetch in "gen.with_timeout"
This is a workaround for an issue where the http client fails to propogate an exception back to the caller, hanging the update process. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
d194ce00ab
commit
bdd270fa4a
|
@ -295,9 +295,11 @@ class UpdateManager:
|
||||||
retries = 5
|
retries = 5
|
||||||
while retries:
|
while retries:
|
||||||
try:
|
try:
|
||||||
resp = await self.http_client.fetch(
|
timeout = time.time() + 10.
|
||||||
|
fut = self.http_client.fetch(
|
||||||
url, headers=headers, connect_timeout=5.,
|
url, headers=headers, connect_timeout=5.,
|
||||||
request_timeout=5., raise_error=False)
|
request_timeout=5., raise_error=False)
|
||||||
|
resp = await tornado.gen.with_timeout(timeout, fut)
|
||||||
except Exception:
|
except Exception:
|
||||||
retries -= 1
|
retries -= 1
|
||||||
msg = f"Error Processing GitHub API request: {url}"
|
msg = f"Error Processing GitHub API request: {url}"
|
||||||
|
@ -346,9 +348,11 @@ class UpdateManager:
|
||||||
retries = 5
|
retries = 5
|
||||||
while retries:
|
while retries:
|
||||||
try:
|
try:
|
||||||
resp = await self.http_client.fetch(
|
timeout = time.time() + 130.
|
||||||
|
fut = self.http_client.fetch(
|
||||||
url, headers={"Accept": "application/zip"},
|
url, headers={"Accept": "application/zip"},
|
||||||
connect_timeout=5., request_timeout=120.)
|
connect_timeout=5., request_timeout=120.)
|
||||||
|
resp = await tornado.gen.with_timeout(timeout, fut)
|
||||||
except Exception:
|
except Exception:
|
||||||
retries -= 1
|
retries -= 1
|
||||||
logging.exception("Error Processing Download")
|
logging.exception("Error Processing Download")
|
||||||
|
|
Loading…
Reference in New Issue