def _periodically_report_status(self):
"""
Greenlet: periodically writes Felix's status into etcd.
:return: Does not return, unless reporting disabled.
"""
_log.info("Started status reporting thread. Waiting for config.")
self._watcher.configured.wait()
ttl = self._config.REPORTING_TTL_SECS
interval = self._config.REPORTING_INTERVAL_SECS
_log.debug("Reporting interval: %s, TTL: %s", interval, ttl)
if interval == 0:
_log.info("Interval is 0, status reporting disabled.")
return
while True:
try:
self._update_felix_status(ttl)
except EtcdException as e:
_log.warning("Error when trying to check into etcd (%r), "
"retrying after %s seconds.", e, RETRY_DELAY)
self.reconnect()
gevent.sleep(RETRY_DELAY)
else:
# Jitter by 10% of interval.
jitter = random.random() * 0.1 * interval
sleep_time = interval + jitter
gevent.sleep(sleep_time)
评论列表
文章目录