mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Converted errch to a buffered channel to avoid goroutine leak
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
This commit is contained in:
parent
0d0af48444
commit
c5f73de4fd
@ -287,7 +287,7 @@ func (c *AvailableConditionController) sync(key string) error {
|
||||
}
|
||||
discoveryURL.Path = "/apis/" + apiService.Spec.Group + "/" + apiService.Spec.Version
|
||||
|
||||
errCh := make(chan error)
|
||||
errCh := make(chan error, 1)
|
||||
go func() {
|
||||
// be sure to check a URL that the aggregated API server is required to serve
|
||||
newReq, err := http.NewRequest("GET", discoveryURL.String(), nil)
|
||||
@ -321,13 +321,6 @@ func (c *AvailableConditionController) sync(key string) error {
|
||||
// we had trouble with slow dial and DNS responses causing us to wait too long.
|
||||
// we added this as insurance
|
||||
case <-time.After(6 * time.Second):
|
||||
// errCh needs to have a reader since the above goroutine doing the work
|
||||
// needs to send to it.
|
||||
go func() {
|
||||
if res := <-errch; res != nil {
|
||||
fmt.Errorf("timed out response from %v: %v", discoveryURL, res)
|
||||
}
|
||||
}()
|
||||
results <- fmt.Errorf("timed out waiting for %v", discoveryURL)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user