feat: Add retry logic when downloading plugins from GitHub#310
Conversation
erezrokah
left a comment
There was a problem hiding this comment.
Thanks for the PR @cychiang! WDYT about using https://github.com/avast/retry-go for the retry logic?
I think it could simplify the code and also avoid the need to write test cases as we rely on an already tested library.
Please let me know that you think
Yes, I do also thinking about the library you mentioned, focusing on the retry itself. But go-resty supports save response into file in the other hand might be helpful to simplify the codebase? But if the project would like to support downloading plugins other than GitHub in the future then I think would be good to consider which one would be good in the next step. Maybe I just make this issue more complicate and confuse 😶🌫️ |
That's a very good point about I can open the issue to use |
Sounds good, let's put |
There was a problem hiding this comment.
This looks great, thanks for the follow up @cychiang 👍
I'll let @yevgenypats comment too
|
I'll go ahead and merge (and release this) as it fixes the bug. We can do any follow in future PRs. One thing I noticed is that the error is printed at the end of all the retry attempts. It would be better to print the attempt on each iteration, which I fixed in a4a4f5f, see: |
|
Thanks for this PR @cychiang 🎸 |
🤖 I have created a release *beep* *boop* --- ## [0.13.20](v0.13.19...v0.13.20) (2022-11-04) ### Features * Add retry logic when downloading plugins from GitHub ([#310](#310)) ([914d252](914d252)) * Enable Multiline table description ([#345](#345)) ([d83c60a](d83c60a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Summary
Fixes #291
Here is the example output if status code != 200:
Use the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)