mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-06 18:03:55 +00:00
Improve Start functions
Kubernetes-commit: d11a9973cfd421b7f723156bbb2b256851f7460d
This commit is contained in:
parent
5f6ea627a3
commit
0a8adc4df4
2
tools/cache/controller.go
vendored
2
tools/cache/controller.go
vendored
@ -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)
|
||||||
}
|
}
|
||||||
|
12
tools/cache/shared_informer.go
vendored
12
tools/cache/shared_informer.go
vendored
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user