Skip to content

Commit fdfc021

Browse files
authored
Merge pull request kubernetes-retired#288 from m-messiah/return-cache-wait
🐛 Return syncer start workers
2 parents d032b2e + 3aa8ed5 commit fdfc021

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

virtualcluster/pkg/syncer/syncer.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,23 @@ func (s *Syncer) Run(stopChan <-chan struct{}) {
233233
}
234234
}()
235235
go wait.Until(s.healthPatrol, 1*time.Minute, stopChan)
236+
go func() {
237+
defer utilruntime.HandleCrash()
238+
defer s.queue.ShutDown()
239+
240+
klog.Infof("starting virtual cluster controller")
241+
defer klog.Infof("shutting down virtual cluster controller")
242+
243+
if !cache.WaitForCacheSync(stopChan, s.virtualClusterSynced) {
244+
return
245+
}
246+
247+
klog.V(5).Infof("starting workers")
248+
for i := 0; i < s.workers; i++ {
249+
go wait.Until(s.run, 1*time.Second, stopChan)
250+
}
251+
<-stopChan
252+
}()
236253
}
237254

238255
// ListenAndServe initializes a server to respond to HTTP network requests on the syncer.

0 commit comments

Comments
 (0)