We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eb5ba88 commit a834022Copy full SHA for a834022
pkg/feeds/maven/maven.go
@@ -72,6 +72,17 @@ func (feed Feed) fetchPackages(page int) ([]Package, error) {
72
}
73
defer resp.Body.Close()
74
75
+ // Handle rate limiting (HTTP status code 429).
76
+ if resp.StatusCode == http.StatusTooManyRequests {
77
+ time.Sleep(5 * time.Second)
78
+ return feed.fetchPackages(page) // Retry the request
79
+ }
80
+
81
+ // Handle other HTTP status codes
82
+ if resp.StatusCode != http.StatusOK {
83
+ return nil, fmt.Errorf("unexpected HTTP status code")
84
85
86
// Decode response.
87
var response Response
88
err = json.NewDecoder(resp.Body).Decode(&response)
0 commit comments