ipfs / ipfs-update

An updater tool for Kubo IPFS binary
https://dist.ipfs.tech/#ipfs-update
MIT License
137 stars 60 forks source link

Added retries flag to install #139

Closed SeppeSoete closed 3 years ago

SeppeSoete commented 3 years ago

Added a flag to the install command to set the amount of retries in case fetching the latest version or installing specified version fails (I currently set the default to 1 retry)

welcome[bot] commented 3 years ago

Thank you for submitting this PR! A maintainer will be here shortly to review it. We are super grateful, but we are also overloaded! Help us by making sure that:

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment. Next steps:

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. We are very grateful for your contribution!

SeppeSoete commented 3 years ago

Before continuing, what's your motivation? What issue did you observe?

The issue I observed was that I tried to run the installer, it failed to fetch the latest version and when I just straight up retried the exact same thing it did work. My motivation was to have the "meh I'll just try it again and see if it works now" already built in so that the odds of someone thinking the installer/ipfs in general is broken due to some random error would be at least a bit lower.

Instead of a "retries" option, it might make more sense to just have the HttpFetcher retry a few times with a short backoff (internally).

That definitely makes more sense, the reason I implemented it as an optional flag was so that the default behaviour could be kept as is if you preferred it that way, but the option would be there to change that behaviour if the user wanted it. Now that I think of it though, I can't really see a user using that setting without running into an error first.

edit: formatting (markdown is hard)

Stebalien commented 3 years ago

The issue I observed was that I tried to run the installer, it failed to fetch the latest version and when I just straight up retried the exact same thing it did work. My motivation was to have the "meh I'll just try it again and see if it works now" already built in so that the odds of someone thinking the installer/ipfs in general is broken due to some random error would be at least a bit lower.

Got it, makes sense. In that case, yeah, the retry logic definitely belongs in the HTTP Fetcher.

Stebalien commented 3 years ago

(closing this PR as the change will need to happen in https://github.com/ipfs/go-ipfs/blob/cd72589cfd41a5397bb8fc9765392bca904b596a/repo/fsrepo/migrations/httpfetcher.go)