From 5d19daa2e22fbec5a00105d24889de86af0cafc8 Mon Sep 17 00:00:00 2001 From: Ke Zhang Date: Wed, 3 Aug 2016 15:36:04 +0800 Subject: [PATCH] optimize podKiller for reading channel --- pkg/kubelet/kubelet.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 449d697aa4c..b704e13878b 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -2107,11 +2107,13 @@ func (kl *Kubelet) podKiller() { for { select { case podPair, ok := <-kl.podKillingCh: - runningPod := podPair.RunningPod - apiPod := podPair.APIPod if !ok { return } + + runningPod := podPair.RunningPod + apiPod := podPair.APIPod + if killing.Has(string(runningPod.ID)) { // The pod is already being killed. break