Commit e1e05913 authored by Ward Loos's avatar Ward Loos

Don't reset global timeout on each for loop iteration

parent be43b7cc
......@@ -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)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment