Bug 227134 - [webkitcorepy] Retry downloads in Autoinstall
Summary: [webkitcorepy] Retry downloads in Autoinstall
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-17 11:30 PDT by Jonathan Bedard
Modified: 2021-06-17 14:27 PDT (History)
2 users (show)

See Also:


Attachments
Patch (4.85 KB, patch)
2021-06-17 11:34 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (4.36 KB, patch)
2021-06-17 13:54 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2021-06-17 11:30:42 PDT
When Autoinstall fails to download a package, we should retry. Note that this retry doesn't extend to running the install operation, which shouldn't be flakey.
Comment 1 Radar WebKit Bug Importer 2021-06-17 11:31:09 PDT
<rdar://problem/79462182>
Comment 2 Jonathan Bedard 2021-06-17 11:34:48 PDT
Created attachment 431693 [details]
Patch
Comment 3 Aakash Jain 2021-06-17 13:23:34 PDT
Comment on attachment 431693 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431693&action=review

> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:100
> +            while count <= (AutoInstall.retry or 0):

Do we need 0 here, can we just ensure AutoInstall.retry is always valid?

> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:114
> +                    if count > (AutoInstall.retry or 0):

Ditto

> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:393
> +    retry = 1

might be better to name it something like: number_of_retry

> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:533
> +    def set_retry(cls, retry):

This method seems unused
Comment 4 Jonathan Bedard 2021-06-17 13:38:56 PDT
Comment on attachment 431693 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431693&action=review

>> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:100
>> +            while count <= (AutoInstall.retry or 0):
> 
> Do we need 0 here, can we just ensure AutoInstall.retry is always valid?

This is to make sure we behave correctly in case retry is "None", and given that the variable doesn't have an _, None feels like a reasonable value

>> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:393
>> +    retry = 1
> 
> might be better to name it something like: number_of_retry

Will change it's name

>> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:533
>> +    def set_retry(cls, retry):
> 
> This method seems unused

It is at the moment, but given this is part of a library, it seems like something someone might one to change at some point in the future
Comment 5 Aakash Jain 2021-06-17 13:43:09 PDT
Comment on attachment 431693 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431693&action=review

>>> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:100
>>> +            while count <= (AutoInstall.retry or 0):
>> 
>> Do we need 0 here, can we just ensure AutoInstall.retry is always valid?
> 
> This is to make sure we behave correctly in case retry is "None", and given that the variable doesn't have an _, None feels like a reasonable value

we can change the default value of retry to 0
Comment 6 Jonathan Bedard 2021-06-17 13:49:12 PDT
(In reply to Aakash Jain from comment #5)
> Comment on attachment 431693 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=431693&action=review
> 
> >>> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/autoinstall.py:100
> >>> +            while count <= (AutoInstall.retry or 0):
> >> 
> >> Do we need 0 here, can we just ensure AutoInstall.retry is always valid?
> > 
> > This is to make sure we behave correctly in case retry is "None", and given that the variable doesn't have an _, None feels like a reasonable value
> 
> we can change the default value of retry to 0

I think we want the default value to be 1. The problem here is if a caller of the library sets "retry" (or "times_to_retry" as will be in the next patch) to "None". Actually, the solution here might be to drop the `set_retry` function, but keep doing something sane when we get a value of "None".
Comment 7 Jonathan Bedard 2021-06-17 13:54:49 PDT
Created attachment 431718 [details]
Patch
Comment 8 EWS 2021-06-17 14:27:24 PDT
Committed r279009 (238934@main): <https://commits.webkit.org/238934@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 431718 [details].