mirror of https://github.com/k3s-io/k3s
Don't reset global timeout on each for loop iteration
parent
be43b7cc9d
commit
e1e0591364
|
@ -610,6 +610,7 @@ func (o *DrainOptions) evictPods(pods []corev1.Pod, policyGroupVersion string, g
|
|||
} else {
|
||||
globalTimeout = o.Timeout
|
||||
}
|
||||
globalTimeoutCh := time.After(globalTimeout)
|
||||
for {
|
||||
select {
|
||||
case err := <-errCh:
|
||||
|
@ -619,7 +620,7 @@ func (o *DrainOptions) evictPods(pods []corev1.Pod, policyGroupVersion string, g
|
|||
if doneCount == len(pods) {
|
||||
return nil
|
||||
}
|
||||
case <-time.After(globalTimeout):
|
||||
case <-globalTimeoutCh:
|
||||
return fmt.Errorf("Drain did not complete within %v", globalTimeout)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue