Stop old validation loops before reinitializing the cluster
Whenever the cluster in initialized, new loops for keepalive validation are created. The old loos should be stopped to not overload the nsx with keepalive checks. Change-Id: I6ae746ba11457c141814424f42e9a0c0e2684601
This commit is contained in:
parent
d93d901450
commit
613cd1865f
|
@ -430,6 +430,7 @@ class ClusteredAPI(object):
|
|||
|
||||
self._http_provider = http_provider
|
||||
self._keepalive_interval = keepalive_interval
|
||||
self._loops = []
|
||||
|
||||
def _init_cluster(*args, **kwargs):
|
||||
self._init_endpoints(providers,
|
||||
|
@ -481,6 +482,11 @@ class ClusteredAPI(object):
|
|||
break
|
||||
eventlet.sleep(0.5)
|
||||
|
||||
if self._loops:
|
||||
for loop in self._loops:
|
||||
loop.stop()
|
||||
self._loops = []
|
||||
|
||||
for endpoint in self._endpoints.values():
|
||||
# dynamic loop for each endpoint to ensure connectivity
|
||||
loop = loopingcall.DynamicLoopingCall(
|
||||
|
@ -488,6 +494,7 @@ class ClusteredAPI(object):
|
|||
loop.start(initial_delay=self._keepalive_interval,
|
||||
periodic_interval_max=self._keepalive_interval,
|
||||
stop_on_exception=False)
|
||||
self._loops.append(loop)
|
||||
|
||||
LOG.debug("Done initializing API endpoint(s). "
|
||||
"API cluster health: %s", self.health)
|
||||
|
|
Loading…
Reference in New Issue