Skip to content

Commit fe3f7fa

Browse files
committed
more
1 parent bf4d961 commit fe3f7fa

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scripts/dotnet.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,23 +785,31 @@ def install(
785785

786786
getLogger().info('Downloading %s', dotnetInstallScriptUrl)
787787
count = 0
788-
while count < 5:
788+
max_count = 10
789+
while count < max_count:
789790
try:
790791
with urlopen(dotnetInstallScriptUrl, context=ssl._create_unverified_context()) as response:
791792
if "html" in response.info()['Content-Type']:
792793
count = count + 1
793-
sleep(1) # sleep one second
794+
sleep(count ** 2)
794795
continue
795796
with open(dotnetInstallScriptPath, 'wb') as outfile:
796797
outfile.write(response.read())
797798
break
799+
except URLError as error:
800+
getLogger().warning(f"Could not download dotnet-install script from {dotnetInstallScriptUrl}; {Reason: {error.reason}}; Attempt {count}")
801+
count = count + 1
802+
sleep(count ** 2)
803+
continue
798804
except Exception as error:
799-
getLogger().warning(f"Could not download dotnet-install script from {dotnetInstallScriptUrl}; Reason: {error.reason}; Attempt {count}")
805+
getLogger().warning(f"Could not download dotnet-install script from {dotnetInstallScriptUrl}; {type(error).__name__}; Attempt {count}")
800806
count = count + 1
801807
sleep(count ** 2)
802808
continue
803809

804-
if count == 5:
810+
getLogger().info(f"Downloaded {dotnetInstallScriptUrl} OK")
811+
812+
if count == max_count:
805813
getLogger().error("Fatal error: could not download dotnet-install script")
806814
raise Exception("Fatal error: could not download dotnet-install script")
807815

0 commit comments

Comments
 (0)