[core] Add timeout and dumb exception handler to manifest download

This commit is contained in:
derrod 2022-12-15 13:23:17 +01:00
parent 87b01b77d8
commit 00f025dcc9

View file

@ -1229,7 +1229,13 @@ class LegendaryCore:
for url in manifest_urls: for url in manifest_urls:
self.log.debug(f'Trying to download manifest from "{url}"...') self.log.debug(f'Trying to download manifest from "{url}"...')
r = self.egs.unauth_session.get(url) try:
r = self.egs.unauth_session.get(url, timeout=10.0)
except Exception as e:
self.log.warning(f'Unable to download manifest from "{urlparse(url).netloc}" '
f'(Exception: {e!r}), trying next URL...')
continue
if r.status_code == 200: if r.status_code == 200:
manifest_bytes = r.content manifest_bytes = r.content
break break