Shared Informer Run blocks until all goroutines finish

Fixes #45454

Kubernetes-commit: d789615902ead2a112ad24fbfebe95285b87004b
This commit is contained in:
Mikhail Mazurskiy
2017-05-27 23:34:58 +10:00
committed by Kubernetes Publisher
parent b5da66a5eb
commit 5f6ea627a3
5 changed files with 33 additions and 37 deletions

View File

@@ -79,17 +79,15 @@ type cacheObj struct {
func (d *defaultCacheMutationDetector) Run(stopCh <-chan struct{}) {
// we DON'T want protection from panics. If we're running this code, we want to die
go func() {
for {
d.CompareObjects()
for {
d.CompareObjects()
select {
case <-stopCh:
return
case <-time.After(d.period):
}
select {
case <-stopCh:
return
case <-time.After(d.period):
}
}()
}
}
// AddObject makes a deep copy of the object for later comparison. It only works on runtime.Object