mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-19 05:34:37 +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):
|
def _download_update_xml(self, update_xml_url):
|
||||||
try:
|
try:
|
||||||
r = requests.get(update_xml_url, timeout=self.timeout)
|
r = requests.get(update_xml_url, timeout=self.timeout)
|
||||||
except (ConnectionResetError, requests.exceptions.ConnectionError):
|
except (ConnectionResetError, requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout):
|
||||||
raise ArchiveConnectionError()
|
raise ArchiveConnectionError()
|
||||||
else:
|
else:
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ class Cli:
|
|||||||
target = args.target
|
target = args.target
|
||||||
try:
|
try:
|
||||||
pl = PackagesList(qt_version, host, target, BASE_URL)
|
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))
|
pl = PackagesList(qt_version, host, target, random.choice(FALLBACK_URLS))
|
||||||
print('List Qt packages in %s for %s' % (args.qt_version, args.host))
|
print('List Qt packages in %s for %s' % (args.qt_version, args.host))
|
||||||
table = Texttable()
|
table = Texttable()
|
||||||
@@ -500,6 +500,9 @@ def installer(qt_archive, base_dir, command, response_timeout=30):
|
|||||||
except requests.exceptions.ConnectionError as e:
|
except requests.exceptions.ConnectionError as e:
|
||||||
logger.error("Connection error: %s" % e.args)
|
logger.error("Connection error: %s" % e.args)
|
||||||
raise e
|
raise e
|
||||||
|
except requests.exceptions.Timeout as e:
|
||||||
|
logger.error("Connection timeout: %s" % e.args)
|
||||||
|
raise e
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
with open(archive, 'wb') as fd:
|
with open(archive, 'wb') as fd:
|
||||||
|
|||||||
Reference in New Issue
Block a user