mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-05 11:16:23 +00:00
fix: update the typo code comment
Kubernetes-commit: d2bab218ddef3fc3f444038420dd500c0e8bc068
This commit is contained in:
parent
eabd4289b0
commit
7c3fa18b11
@ -710,7 +710,7 @@ func updateURLMetrics(ctx context.Context, req *Request, resp *http.Response, er
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
metrics.RequestResult.Increment(ctx, "<error>", req.verb, url)
|
metrics.RequestResult.Increment(ctx, "<error>", req.verb, url)
|
||||||
} else {
|
} else {
|
||||||
//Metrics for failure codes
|
// Metrics for failure codes
|
||||||
metrics.RequestResult.Increment(ctx, strconv.Itoa(resp.StatusCode), req.verb, url)
|
metrics.RequestResult.Increment(ctx, strconv.Itoa(resp.StatusCode), req.verb, url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -823,7 +823,7 @@ func (r *Request) newHTTPRequest(ctx context.Context) (*http.Request, error) {
|
|||||||
// fn at most once. It will return an error if a problem occurred prior to connecting to the
|
// fn at most once. It will return an error if a problem occurred prior to connecting to the
|
||||||
// server - the provided function is responsible for handling server errors.
|
// server - the provided function is responsible for handling server errors.
|
||||||
func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Response)) error {
|
func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Response)) error {
|
||||||
//Metrics for total request latency
|
// Metrics for total request latency
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
defer func() {
|
defer func() {
|
||||||
metrics.RequestLatency.Observe(ctx, r.verb, *r.URL(), time.Since(start))
|
metrics.RequestLatency.Observe(ctx, r.verb, *r.URL(), time.Since(start))
|
||||||
@ -892,7 +892,7 @@ func (r *Request) request(ctx context.Context, fn func(*http.Request, *http.Resp
|
|||||||
done := func() bool {
|
done := func() bool {
|
||||||
defer readAndCloseResponseBody(resp)
|
defer readAndCloseResponseBody(resp)
|
||||||
|
|
||||||
// if the the server returns an error in err, the response will be nil.
|
// if the server returns an error in err, the response will be nil.
|
||||||
f := func(req *http.Request, resp *http.Response) {
|
f := func(req *http.Request, resp *http.Response) {
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
return
|
return
|
||||||
|
@ -2564,7 +2564,7 @@ func TestRequestWatchWithRetry(t *testing.T) {
|
|||||||
testRequestWithRetry(t, "Watch", func(ctx context.Context, r *Request) {
|
testRequestWithRetry(t, "Watch", func(ctx context.Context, r *Request) {
|
||||||
w, err := r.Watch(ctx)
|
w, err := r.Watch(ctx)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// in this test the the response body returned by the server is always empty,
|
// in this test the response body returned by the server is always empty,
|
||||||
// this will cause StreamWatcher.receive() to:
|
// this will cause StreamWatcher.receive() to:
|
||||||
// - return an io.EOF to indicate that the watch closed normally and
|
// - return an io.EOF to indicate that the watch closed normally and
|
||||||
// - then close the io.Reader
|
// - then close the io.Reader
|
||||||
|
Loading…
Reference in New Issue
Block a user