Improve Start functions

Kubernetes-commit: d11a9973cfd421b7f723156bbb2b256851f7460d
This commit is contained in:
Mikhail Mazurskiy 2017-06-07 09:25:30 +10:00 committed by Kubernetes Publisher
parent 5f6ea627a3
commit 0a8adc4df4
2 changed files with 7 additions and 7 deletions

View File

@ -119,7 +119,7 @@ func (c *controller) Run(stopCh <-chan struct{}) {
var wg sync.WaitGroup var wg sync.WaitGroup
defer wg.Wait() defer wg.Wait()
wait.StartUntil(stopCh, &wg, r.Run) wait.StartWithChannelWithinGroup(stopCh, &wg, r.Run)
wait.Until(c.processLoop, time.Second, stopCh) wait.Until(c.processLoop, time.Second, stopCh)
} }

View File

@ -211,8 +211,8 @@ func (s *sharedIndexInformer) Run(stopCh <-chan struct{}) {
defer s.wg.Wait() defer s.wg.Wait()
wait.StartUntil(stopCh, &s.wg, s.cacheMutationDetector.Run) wait.StartWithChannelWithinGroup(stopCh, &s.wg, s.cacheMutationDetector.Run)
wait.StartUntil(stopCh, &s.wg, s.processor.run) wait.StartWithChannelWithinGroup(stopCh, &s.wg, s.processor.run)
s.controller.Run(stopCh) s.controller.Run(stopCh)
} }
@ -327,8 +327,8 @@ func (s *sharedIndexInformer) AddEventHandlerWithResyncPeriod(handler ResourceEv
s.processor.addListener(listener) s.processor.addListener(listener)
wait.StartUntil(s.stopCh, &s.wg, listener.run) wait.StartWithChannelWithinGroup(s.stopCh, &s.wg, listener.run)
wait.StartUntil(s.stopCh, &s.wg, listener.pop) wait.StartWithChannelWithinGroup(s.stopCh, &s.wg, listener.pop)
items := s.indexer.List() items := s.indexer.List()
for i := range items { for i := range items {
@ -403,8 +403,8 @@ func (p *sharedProcessor) run(stopCh <-chan struct{}) {
p.listenersLock.RLock() p.listenersLock.RLock()
defer p.listenersLock.RUnlock() defer p.listenersLock.RUnlock()
for _, listener := range p.listeners { for _, listener := range p.listeners {
wait.StartUntil(stopCh, &wg, listener.run) wait.StartWithChannelWithinGroup(stopCh, &wg, listener.run)
wait.StartUntil(stopCh, &wg, listener.pop) wait.StartWithChannelWithinGroup(stopCh, &wg, listener.pop)
} }
}() }()
wg.Wait() wg.Wait()