Unverified Commit 7ac32a4f authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #61983 from mikedanese/closur

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. volumemanager: remove unneccesary closure ```release-note NONE ```
parents e322d148 f3922dff
...@@ -130,13 +130,13 @@ func (dswp *desiredStateOfWorldPopulator) Run(sourcesReady config.SourcesReady, ...@@ -130,13 +130,13 @@ func (dswp *desiredStateOfWorldPopulator) Run(sourcesReady config.SourcesReady,
glog.Infof("Desired state populator starts to run") glog.Infof("Desired state populator starts to run")
wait.PollUntil(dswp.loopSleepDuration, func() (bool, error) { wait.PollUntil(dswp.loopSleepDuration, func() (bool, error) {
done := sourcesReady.AllReady() done := sourcesReady.AllReady()
dswp.populatorLoopFunc()() dswp.populatorLoop()
return done, nil return done, nil
}, stopCh) }, stopCh)
dswp.hasAddedPodsLock.Lock() dswp.hasAddedPodsLock.Lock()
dswp.hasAddedPods = true dswp.hasAddedPods = true
dswp.hasAddedPodsLock.Unlock() dswp.hasAddedPodsLock.Unlock()
wait.Until(dswp.populatorLoopFunc(), dswp.loopSleepDuration, stopCh) wait.Until(dswp.populatorLoop, dswp.loopSleepDuration, stopCh)
} }
func (dswp *desiredStateOfWorldPopulator) ReprocessPod( func (dswp *desiredStateOfWorldPopulator) ReprocessPod(
...@@ -150,26 +150,24 @@ func (dswp *desiredStateOfWorldPopulator) HasAddedPods() bool { ...@@ -150,26 +150,24 @@ func (dswp *desiredStateOfWorldPopulator) HasAddedPods() bool {
return dswp.hasAddedPods return dswp.hasAddedPods
} }
func (dswp *desiredStateOfWorldPopulator) populatorLoopFunc() func() { func (dswp *desiredStateOfWorldPopulator) populatorLoop() {
return func() { dswp.findAndAddNewPods()
dswp.findAndAddNewPods()
// findAndRemoveDeletedPods() calls out to the container runtime to
// findAndRemoveDeletedPods() calls out to the container runtime to // determine if the containers for a given pod are terminated. This is
// determine if the containers for a given pod are terminated. This is // an expensive operation, therefore we limit the rate that
// an expensive operation, therefore we limit the rate that // findAndRemoveDeletedPods() is called independently of the main
// findAndRemoveDeletedPods() is called independently of the main // populator loop.
// populator loop. if time.Since(dswp.timeOfLastGetPodStatus) < dswp.getPodStatusRetryDuration {
if time.Since(dswp.timeOfLastGetPodStatus) < dswp.getPodStatusRetryDuration { glog.V(5).Infof(
glog.V(5).Infof( "Skipping findAndRemoveDeletedPods(). Not permitted until %v (getPodStatusRetryDuration %v).",
"Skipping findAndRemoveDeletedPods(). Not permitted until %v (getPodStatusRetryDuration %v).", dswp.timeOfLastGetPodStatus.Add(dswp.getPodStatusRetryDuration),
dswp.timeOfLastGetPodStatus.Add(dswp.getPodStatusRetryDuration), dswp.getPodStatusRetryDuration)
dswp.getPodStatusRetryDuration)
return
}
dswp.findAndRemoveDeletedPods() return
} }
dswp.findAndRemoveDeletedPods()
} }
func (dswp *desiredStateOfWorldPopulator) isPodTerminated(pod *v1.Pod) bool { func (dswp *desiredStateOfWorldPopulator) isPodTerminated(pod *v1.Pod) bool {
......
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