Don't reset global timeout on each for loop iteration

pull/8/head
Ward Loos 2018-05-27 20:26:37 +02:00
parent be43b7cc9d
commit e1e0591364
1 changed files with 2 additions and 1 deletions

View File

@ -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)
}
}