allow lock acquisition injection for quota admission

This commit is contained in:
deads2k
2016-07-05 13:52:57 -04:00
parent 145da49cf7
commit ada37c2163
4 changed files with 28 additions and 13 deletions

View File

@@ -92,6 +92,9 @@ type sharedIndexInformer struct {
// blockDeltas gives a way to stop all event distribution so that a late event handler
// can safely join the shared informer.
blockDeltas sync.Mutex
// stopCh is the channel used to stop the main Run process. We have to track it so that
// late joiners can have a proper stop
stopCh <-chan struct{}
}
// dummyController hides the fact that a SharedInformer is different from a dedicated one
@@ -146,6 +149,7 @@ func (s *sharedIndexInformer) Run(stopCh <-chan struct{}) {
s.started = true
}()
s.stopCh = stopCh
s.processor.run(stopCh)
s.controller.Run(stopCh)
}
@@ -220,6 +224,9 @@ func (s *sharedIndexInformer) AddEventHandler(handler ResourceEventHandler) erro
listener := newProcessListener(handler)
s.processor.listeners = append(s.processor.listeners, listener)
go listener.run(s.stopCh)
go listener.pop(s.stopCh)
items := s.indexer.List()
for i := range items {
listener.add(addNotification{newObj: items[i]})