Skip to content

Commit 6b65bc7

Browse files
authored
Merge pull request kubernetes#91048 from pjbgf/fix-error-validation
linkcheck: Fix incorrect error validation for Retry-After
2 parents 8b9c9ea + e7ced21 commit 6b65bc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/linkcheck/links.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
134134
// And Go client will follow redirects automatically so the 301 check is probably unnecessary.
135135
if resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode == http.StatusServiceUnavailable {
136136
retryAfter := resp.Header.Get("Retry-After")
137-
if seconds, err := strconv.Atoi(retryAfter); err != nil {
137+
if seconds, err := strconv.Atoi(retryAfter); err == nil {
138138
backoff = seconds + 10
139139
}
140140
fmt.Fprintf(os.Stderr, "Got %d visiting %s, retry after %d seconds.\n", resp.StatusCode, string(URL), backoff)

0 commit comments

Comments
 (0)