File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
pkg/controller/clusterstate/cache Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,10 @@ import (
4848 "k8s.io/klog/v2"
4949
5050 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/controller/clusterstate/api"
51+ "k8s.io/apimachinery/pkg/util/wait"
5152)
5253
53- // New returns a Cache implementation.
54+ //New returns a Cache implementation.
5455func New (config * rest.Config ) Cache {
5556 return newClusterStateCache (config )
5657}
@@ -101,7 +102,7 @@ func (sc *ClusterStateCache) Run(stopCh <-chan struct{}) {
101102 go sc .nodeInformer .Informer ().Run (stopCh )
102103
103104 // Update cache
104- go sc .updateCache ( )
105+ go wait . Until ( sc .updateCache , 1 * time . Second , stopCh )
105106
106107}
107108
@@ -243,15 +244,11 @@ func (sc *ClusterStateCache) updateState() error {
243244
244245func (sc * ClusterStateCache ) updateCache () {
245246 klog .V (9 ).Infof ("Starting to update Cluster State Cache" )
246-
247- for {
248- err := sc .updateState ()
249- if err != nil {
250- klog .Errorf ("Failed update state: %v" , err )
251- }
252-
253- time .Sleep (1 * time .Second )
247+ err := sc .updateState ()
248+ if err != nil {
249+ klog .Errorf ("Failed update state: %v" , err )
254250 }
251+ return
255252}
256253
257254func (sc * ClusterStateCache ) Snapshot () * api.ClusterInfo {
You can’t perform that action at this time.
0 commit comments