@@ -461,11 +461,10 @@ func (r *templateRouter) FilterNamespaces(namespaces sets.String) {
461
461
r .lock .Lock ()
462
462
defer r .lock .Unlock ()
463
463
464
- r .stateChanged = true
465
-
466
464
if len (namespaces ) == 0 {
467
465
r .state = make (map [string ]ServiceAliasConfig )
468
466
r .serviceUnits = make (map [string ]ServiceUnit )
467
+ r .stateChanged = true
469
468
}
470
469
for k := range r .serviceUnits {
471
470
// TODO: the id of a service unit should be defined inside this class, not passed in from the outside
@@ -475,6 +474,7 @@ func (r *templateRouter) FilterNamespaces(namespaces sets.String) {
475
474
continue
476
475
}
477
476
delete (r .serviceUnits , k )
477
+ r .stateChanged = true
478
478
}
479
479
480
480
for k := range r .state {
@@ -483,6 +483,7 @@ func (r *templateRouter) FilterNamespaces(namespaces sets.String) {
483
483
continue
484
484
}
485
485
delete (r .state , k )
486
+ r .stateChanged = true
486
487
}
487
488
}
488
489
@@ -534,8 +535,6 @@ func (r *templateRouter) DeleteEndpoints(id string) {
534
535
r .lock .Lock ()
535
536
defer r .lock .Unlock ()
536
537
537
- r .stateChanged = true
538
-
539
538
service , ok := r .findMatchingServiceUnit (id )
540
539
if ! ok {
541
540
return
@@ -551,6 +550,8 @@ func (r *templateRouter) DeleteEndpoints(id string) {
551
550
r .peerEndpoints = []Endpoint {}
552
551
glog .V (4 ).Infof ("Peer endpoint table has been cleared" )
553
552
}
553
+
554
+ r .stateChanged = true
554
555
}
555
556
556
557
// routeKey generates route key in form of Namespace_Name. This is NOT the normal key structure of ns/name because
@@ -658,8 +659,6 @@ func (r *templateRouter) RemoveRoute(route *routeapi.Route) {
658
659
r .lock .Lock ()
659
660
defer r .lock .Unlock ()
660
661
661
- r .stateChanged = true
662
-
663
662
routeKey := r .routeKey (route )
664
663
serviceAliasConfig , ok := r .state [routeKey ]
665
664
if ! ok {
@@ -668,6 +667,7 @@ func (r *templateRouter) RemoveRoute(route *routeapi.Route) {
668
667
669
668
r .cleanUpServiceAliasConfig (& serviceAliasConfig )
670
669
delete (r .state , routeKey )
670
+ r .stateChanged = true
671
671
}
672
672
673
673
// AddEndpoints adds new Endpoints for the given id.
0 commit comments