feat: add log if github is rate limiting

This commit is contained in:
2026-02-10 20:46:05 +00:00
parent f79c9f2865
commit 031b01ac37
2 changed files with 18 additions and 0 deletions
+12
View File
@@ -28,6 +28,12 @@ func getPushPatches(user string) ([]string, error) {
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusForbidden || resp.StatusCode == http.StatusTooManyRequests {
if resp.Header.Get("X-RateLimit-Remaining") == "0" {
return nil, fmt.Errorf("github rate limit exceeded")
}
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("github api failed")
}
@@ -82,6 +88,12 @@ func getUniqueTzFromPatches(patchUrls []string) ([]string, error) {
return nil, fmt.Errorf("failed to get patch")
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusForbidden || resp.StatusCode == http.StatusTooManyRequests {
if resp.Header.Get("X-RateLimit-Remaining") == "0" {
return nil, fmt.Errorf("github rate limit exceeded")
}
}
if resp.StatusCode != 200 {
// the DOCS say that some larges ones may time out
// and they DID