-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updater: add retry downloadUpdate()
#1389
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good improvement, but I don't think it's going to fix all edge cases. If I am on a long train ride with a spotty internet connection, all 10 retries may happen while I am offline. Then, I end up in the same broken state.
Given that, I am not sure if it's worth landing this PR at all.
WDYT?
A more robust solution to consider:
- Change the "check for update" frequency from 12 hours to 1 hour
- When checking for a new version, check our state. If there is a new version that we could not download before, then trigger the download. If there is no new version, then trigger the check for a new version.
Alternatively, we can also enable the electron-updater's auto-download feature; maybe it will work better. It makes me wonder why we have disabled it in the past.
I agree this doesn't solve all cases, but it can handle more cases than the current implementation. Plus, it doesn't introduce any complexity in how we're handling our state.
Isn't this effectively the same thing as in this PR, only without exponential backoff and with infinite retries? What about instead configuring the retry logic to have 100 retries? I like this way because we're not introducing any existing state to the updater library.
Do you have a link to this feature? I'm not finding it in their docs |
Fair enough 👍🏻
This PR does introduce a new state to the updater library and this state is hidden inside pRetry logic. We have no control of that state - for example, it's not possible to abort pRetry loop trying to download version X after we detect that version X+1 is available. We can end up with multiple pRetry loops running at the same time. (Fortunately, the API for downloading the update is not version specific, so in the edge case I described, both pRetry loops will try to download the version X+1.) A possible fix is to setup an AbortController, pass the Personally, I prefer to be explicit and manage the state ourselves.
Docs (very brief, unfortunately): |
Agreed, I should have been more explicit here. This PR doesn't introduce any state that we need to manage. To the outside it's indistinguishable if we have one download call that takes 10 minutes, or whether we are on the 5th retry of faster performing download calls.
As you suggested, this is possible: https://github.com/sindresorhus/p-retry?tab=readme-ov-file#signal. To me this is also very similar to not having retry logic, but one small running download call (downloading one electron app over train internet can also take long. Admittedly not 24h, but just as long maybe as 10 retries on a faster internet.
I disagree here, as this also complicates the updater, just in another way. What about we merge this as is, as it's already an improvement, and then discuss further improving this logic in a separate PR? I personally am not interested in following up at this moment, until we get new bug reports after this logic has been merged and proved to still be insufficient. |
Agreed 👍🏻 |
Ref https://filecoinproject.slack.com/archives/C03PVLW721L/p1709739129656009