File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -785,23 +785,31 @@ def install(
785
785
786
786
getLogger ().info ('Downloading %s' , dotnetInstallScriptUrl )
787
787
count = 0
788
- while count < 5 :
788
+ max_count = 10
789
+ while count < max_count :
789
790
try :
790
791
with urlopen (dotnetInstallScriptUrl , context = ssl ._create_unverified_context ()) as response :
791
792
if "html" in response .info ()['Content-Type' ]:
792
793
count = count + 1
793
- sleep (1 ) # sleep one second
794
+ sleep (count ** 2 )
794
795
continue
795
796
with open (dotnetInstallScriptPath , 'wb' ) as outfile :
796
797
outfile .write (response .read ())
797
798
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
798
804
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 } " )
800
806
count = count + 1
801
807
sleep (count ** 2 )
802
808
continue
803
809
804
- if count == 5 :
810
+ getLogger ().info (f"Downloaded { dotnetInstallScriptUrl } OK" )
811
+
812
+ if count == max_count :
805
813
getLogger ().error ("Fatal error: could not download dotnet-install script" )
806
814
raise Exception ("Fatal error: could not download dotnet-install script" )
807
815
You can’t perform that action at this time.
0 commit comments