From 917d883d51ff0f0c1901929a9dbd5ca8e3632f57 Mon Sep 17 00:00:00 2001 From: Emanuele Trabattoni Date: Thu, 2 Oct 2025 22:22:57 +0200 Subject: [PATCH] sono stupido --- routermon/routermon.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/routermon/routermon.py b/routermon/routermon.py index 55e8ba2..7057819 100644 --- a/routermon/routermon.py +++ b/routermon/routermon.py @@ -5,7 +5,7 @@ import logging import json import routeros_api -from pyutils.utils import * +from utils import * from influxdb_client_3 import InfluxDBClient3, Point # Get environment variables @@ -65,7 +65,10 @@ def main() -> int: if_stats_old = if_stats LOGGER.debug(f"\nInterfaces: {json.dumps(if_stats, indent = 2)}") LOGGER.debug(f"\nResources: {json.dumps(hw_stats, indent = 2)}") - time.sleep(INTERVAL-(last-now)) + last: float = time.time() + cycle_time: float = last - now + LOGGER.debug(f"Cycle Time: {cycle_time:4.3f}") + time.sleep(INTERVAL-cycle_time) except Exception as e: print(f"Unexpected exception: [{e}]") return 1