generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Labels
issue/staleIssue has not had any activity for an extended period of timeIssue has not had any activity for an extended period of timekind/bugSomething isn't workingSomething isn't working
Description
Current Behavior
The GetAllAhHelmPackages function in utils/artifacthub.go has two main problems:
- No Rate Limiting: The code hits the Artifact Hub API too fast. When it receives a
429 Too Many Requestserror, it fails immediately instead of waiting and trying again. - Memory Leak: It uses
defer resp.Body.Close()inside aforloop. In Go,deferwaits for the function to finish, not the loop. This keeps thousands of connections open at the same time, wasting memory.
Expected Behavior
- Handle 429s: The code should sleep and retry if it hits a rate limit (exponential backoff).
- Fix Leak: The response body should be closed immediately after each loop iteration, not at the end of the function.
Screenshots/Logs
The code pattern causing the leak:
for _, p := range res {
// ...
resp, err := http.Get(url)
// ...
defer resp.Body.Close() // <--- Bad: This waits until the whole function is done
// ...
}Metadata
Metadata
Assignees
Labels
issue/staleIssue has not had any activity for an extended period of timeIssue has not had any activity for an extended period of timekind/bugSomething isn't workingSomething isn't working