mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #37349 from tanshanshan/httpcode
Automatic merge from submit-queue replace HTTP status code with HTTP status code const <!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md 2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md 3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes --> **What this PR does / why we need it**: replace HTTP status code with HTTP status code const Thanks! **Special notes for your reviewer**: **Release note**: <!-- Steps to write your release note: 1. Use the release-note-* labels to set the release note state (if you have access) 2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. --> ```release-note ```
This commit is contained in:
commit
53d41d036d
@ -129,7 +129,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if resp.StatusCode == 429 {
|
if resp.StatusCode == http.StatusTooManyRequests {
|
||||||
retryAfter := resp.Header.Get("Retry-After")
|
retryAfter := resp.Header.Get("Retry-After")
|
||||||
if seconds, err := strconv.Atoi(retryAfter); err != nil {
|
if seconds, err := strconv.Atoi(retryAfter); err != nil {
|
||||||
backoff = seconds + 10
|
backoff = seconds + 10
|
||||||
@ -138,7 +138,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
|
|||||||
time.Sleep(time.Duration(backoff) * time.Second)
|
time.Sleep(time.Duration(backoff) * time.Second)
|
||||||
backoff *= 2
|
backoff *= 2
|
||||||
retry++
|
retry++
|
||||||
} else if resp.StatusCode == 404 {
|
} else if resp.StatusCode == http.StatusNotFound {
|
||||||
// We only check for 404 error for now. 401, 403 errors are hard to handle.
|
// We only check for 404 error for now. 401, 403 errors are hard to handle.
|
||||||
|
|
||||||
// We need to try a GET to avoid false alert.
|
// We need to try a GET to avoid false alert.
|
||||||
@ -146,7 +146,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if resp.StatusCode != 404 {
|
if resp.StatusCode != http.StatusNotFound {
|
||||||
continue URL
|
continue URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user