mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-18 21:24:38 +03:00
Catch timeout connection then fallback
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
This commit is contained in:
@@ -184,7 +184,7 @@ class QtArchives:
|
||||
def _download_update_xml(self, update_xml_url):
|
||||
try:
|
||||
r = requests.get(update_xml_url, timeout=self.timeout)
|
||||
except (ConnectionResetError, requests.exceptions.ConnectionError):
|
||||
except (ConnectionResetError, requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout):
|
||||
raise ArchiveConnectionError()
|
||||
else:
|
||||
if r.status_code == 200:
|
||||
|
||||
@@ -336,7 +336,7 @@ class Cli:
|
||||
target = args.target
|
||||
try:
|
||||
pl = PackagesList(qt_version, host, target, BASE_URL)
|
||||
except requests.exceptions.ConnectionError:
|
||||
except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout):
|
||||
pl = PackagesList(qt_version, host, target, random.choice(FALLBACK_URLS))
|
||||
print('List Qt packages in %s for %s' % (args.qt_version, args.host))
|
||||
table = Texttable()
|
||||
@@ -500,6 +500,9 @@ def installer(qt_archive, base_dir, command, response_timeout=30):
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
logger.error("Connection error: %s" % e.args)
|
||||
raise e
|
||||
except requests.exceptions.Timeout as e:
|
||||
logger.error("Connection timeout: %s" % e.args)
|
||||
raise e
|
||||
else:
|
||||
try:
|
||||
with open(archive, 'wb') as fd:
|
||||
|
||||
Reference in New Issue
Block a user