max_interval = 300
backoff_factor = 1.5
consecutive_failures = 0
+ heartbeat_interval = 300
+ last_heartbeat = time.monotonic()
while not self.stop:
try:
self.log.debug(
"All threads are alive, next check in %ds.", check_interval
)
+ now = time.monotonic()
+ if now - last_heartbeat >= heartbeat_interval:
+ self.log.info(
+ "node-proxy running (heartbeat), next check in %ds.",
+ heartbeat_interval,
+ )
+ last_heartbeat = now
except Exception as e:
consecutive_failures += 1
self.log.error(
DEFAULT_MAX_RETRIES = 30
RETRY_SLEEP_SEC = 5
+HEARTBEAT_INTERVAL_SEC = 300
class Reporter(BaseThread):
return False
def main(self) -> None:
+ last_heartbeat = time.monotonic()
while not self.stop:
self.log.debug("waiting for a lock in reporter loop.")
with self.system.lock:
else:
self.log.debug("no diff, not sending data to the mgr.")
self.log.debug("lock released in reporter loop.")
+ now = time.monotonic()
+ if now - last_heartbeat >= HEARTBEAT_INTERVAL_SEC:
+ self.log.info(
+ "Reporter running (heartbeat), next check in %ds.",
+ HEARTBEAT_INTERVAL_SEC,
+ )
+ last_heartbeat = now
time.sleep(5)
self.log.debug("exiting reporter loop.")
raise SystemExit(0)