merge with refactor-tpr

This commit is contained in:
Murat Kabilov 2017-07-25 10:41:14 +02:00
parent acebdf0122
commit 848a37e94d
1 changed files with 16 additions and 11 deletions

View File

@ -169,25 +169,30 @@ func (c *Controller) initController() {
} }
func (c *Controller) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) { func (c *Controller) Run(stopCh <-chan struct{}, wg *sync.WaitGroup) {
defer wg.Done()
wg.Add(1)
c.initController() c.initController()
go c.runInformers(stopCh) wg.Add(4)
go c.runPodInformer(stopCh, wg)
go c.runPostgresqlInformer(stopCh, wg)
go c.podEventsDispatcher(stopCh, wg)
go c.clusterResync(stopCh, wg)
for i := range c.clusterEventQueues { for i := range c.clusterEventQueues {
go c.processClusterEventsQueue(i) wg.Add(1)
go c.processClusterEventsQueue(stopCh, i, wg)
} }
c.logger.Info("Started working in background") c.logger.Info("Started working in background")
} }
func (c *Controller) runInformers(stopCh <-chan struct{}) { func (c *Controller) runPodInformer(stopCh <-chan struct{}, wg *sync.WaitGroup) {
go c.postgresqlInformer.Run(stopCh) defer wg.Done()
go c.podInformer.Run(stopCh)
go c.podEventsDispatcher(stopCh)
go c.clusterResync(stopCh)
<-stopCh c.podInformer.Run(stopCh)
} }
func (c *Controller) runPostgresqlInformer(stopCh <-chan struct{}, wg *sync.WaitGroup) {
defer wg.Done()
c.postgresqlInformer.Run(stopCh)
}