mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
fix static-check for staging/src/k8s.io/client-go/
Signed-off-by: HaoJie Liu <liuhaojie@beyondcent.com>
This commit is contained in:
parent
2a017f94bc
commit
6022b69dfd
@ -491,7 +491,7 @@ func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
|||||||
DNSDone: func(info httptrace.DNSDoneInfo) {
|
DNSDone: func(info httptrace.DNSDoneInfo) {
|
||||||
reqInfo.muTrace.Lock()
|
reqInfo.muTrace.Lock()
|
||||||
defer reqInfo.muTrace.Unlock()
|
defer reqInfo.muTrace.Unlock()
|
||||||
reqInfo.DNSLookup = time.Now().Sub(dnsStart)
|
reqInfo.DNSLookup = time.Since(dnsStart)
|
||||||
klog.Infof("HTTP Trace: DNS Lookup for %s resolved to %v", host, info.Addrs)
|
klog.Infof("HTTP Trace: DNS Lookup for %s resolved to %v", host, info.Addrs)
|
||||||
},
|
},
|
||||||
// Dial
|
// Dial
|
||||||
@ -503,7 +503,7 @@ func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
|||||||
ConnectDone: func(network, addr string, err error) {
|
ConnectDone: func(network, addr string, err error) {
|
||||||
reqInfo.muTrace.Lock()
|
reqInfo.muTrace.Lock()
|
||||||
defer reqInfo.muTrace.Unlock()
|
defer reqInfo.muTrace.Unlock()
|
||||||
reqInfo.Dialing = time.Now().Sub(dialStart)
|
reqInfo.Dialing = time.Since(dialStart)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Infof("HTTP Trace: Dial to %s:%s failed: %v", network, addr, err)
|
klog.Infof("HTTP Trace: Dial to %s:%s failed: %v", network, addr, err)
|
||||||
} else {
|
} else {
|
||||||
@ -517,7 +517,7 @@ func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
|||||||
TLSHandshakeDone: func(_ tls.ConnectionState, _ error) {
|
TLSHandshakeDone: func(_ tls.ConnectionState, _ error) {
|
||||||
reqInfo.muTrace.Lock()
|
reqInfo.muTrace.Lock()
|
||||||
defer reqInfo.muTrace.Unlock()
|
defer reqInfo.muTrace.Unlock()
|
||||||
reqInfo.TLSHandshake = time.Now().Sub(tlsStart)
|
reqInfo.TLSHandshake = time.Since(tlsStart)
|
||||||
},
|
},
|
||||||
// Connection (it can be DNS + Dial or just the time to get one from the connection pool)
|
// Connection (it can be DNS + Dial or just the time to get one from the connection pool)
|
||||||
GetConn: func(hostPort string) {
|
GetConn: func(hostPort string) {
|
||||||
@ -526,7 +526,7 @@ func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
|||||||
GotConn: func(info httptrace.GotConnInfo) {
|
GotConn: func(info httptrace.GotConnInfo) {
|
||||||
reqInfo.muTrace.Lock()
|
reqInfo.muTrace.Lock()
|
||||||
defer reqInfo.muTrace.Unlock()
|
defer reqInfo.muTrace.Unlock()
|
||||||
reqInfo.GetConnection = time.Now().Sub(getConn)
|
reqInfo.GetConnection = time.Since(getConn)
|
||||||
reqInfo.ConnectionReused = info.Reused
|
reqInfo.ConnectionReused = info.Reused
|
||||||
},
|
},
|
||||||
// Server Processing (time since we wrote the request until first byte is received)
|
// Server Processing (time since we wrote the request until first byte is received)
|
||||||
@ -538,7 +538,7 @@ func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
|||||||
GotFirstResponseByte: func() {
|
GotFirstResponseByte: func() {
|
||||||
reqInfo.muTrace.Lock()
|
reqInfo.muTrace.Lock()
|
||||||
defer reqInfo.muTrace.Unlock()
|
defer reqInfo.muTrace.Unlock()
|
||||||
reqInfo.ServerProcessing = time.Now().Sub(serverStart)
|
reqInfo.ServerProcessing = time.Since(serverStart)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
|
req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
|
||||||
|
@ -100,7 +100,7 @@ func TestCloseAllRace(t *testing.T) {
|
|||||||
dialer.CloseAll()
|
dialer.CloseAll()
|
||||||
|
|
||||||
// Expect all connections to close within 5 seconds
|
// Expect all connections to close within 5 seconds
|
||||||
for start := time.Now(); time.Now().Sub(start) < 5*time.Second; time.Sleep(10 * time.Millisecond) {
|
for start := time.Now(); time.Since(start) < 5*time.Second; time.Sleep(10 * time.Millisecond) {
|
||||||
// Ensure all connections were closed
|
// Ensure all connections were closed
|
||||||
if c := atomic.LoadInt64(&conns); c == 0 {
|
if c := atomic.LoadInt64(&conns); c == 0 {
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user