fix: handle rate limits and resource leaks in Artifact Hub sync#856
fix: handle rate limits and resource leaks in Artifact Hub sync#856parthivsaikia wants to merge 3 commits intomeshery:masterfrom
Conversation
Signed-off-by: PARTHIV PRATIM SAIKIA <parthivsaikia985@gmail.com>
Summary of ChangesHello @parthivsaikia, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the stability and reliability of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the rate limiting and resource leak issues in GetAllAhHelmPackages. The introduction of exponential backoff is a solid improvement over a static sleep, and the resource leak from defer inside a loop is correctly fixed. My review includes a few suggestions to further improve robustness and maintainability: one critical fix for potential panics from unsafe type assertions, and recommendations to replace fmt.Println with proper logging and to use a constant for the retry count.
Signed-off-by: PARTHIV PRATIM SAIKIA <parthivsaikia985@gmail.com>
aa5c04a to
af57f00
Compare
| "github.com/meshery/schemas/models/v1beta1/category" | ||
| _component "github.com/meshery/schemas/models/v1beta1/component" | ||
| "github.com/meshery/schemas/models/v1beta1/model" | ||
| "github.com/sirupsen/logrus" |
There was a problem hiding this comment.
Use MeshKit's logger instead.
Description
This PR addresses critical stability issues identified in the
GetAllAhHelmPackagesfunction during high-volume syncs with Artifact Hub.Changes included:
429 Too Many Requestserrors gracefully.defer resp.Body.Close()was placed inside aforloop (which only closes resources on function return). The response body is now closed explicitly after each iteration.This PR fixes #855
Signed commits