display tag fro alterts, cleanup udp
This commit is contained in:
+3
-23
@@ -30,6 +30,8 @@ def cleanup_function(config, hbdclass):
|
||||
# Ensure all timer references are cleared before pickling
|
||||
for hostname, host in list(hbdclass.Host.hosts.items()):
|
||||
for conn_type, conn in host.connections.items():
|
||||
if hasattr(conn, 'cancel_overdue_timer'):
|
||||
conn.cancel_overdue_timer()
|
||||
if hasattr(conn, 'overdue_timer'):
|
||||
conn.overdue_timer = None
|
||||
if hasattr(conn, 'overdue_callback'):
|
||||
@@ -65,7 +67,6 @@ async def _run_async(config):
|
||||
from . import http as http_mod
|
||||
from . import dns as dns_mod
|
||||
from . import notify as notify_mod
|
||||
from . import monitor as monitor_mod
|
||||
from . import journal as journal_mod
|
||||
from . import threshold as threshold_mod
|
||||
|
||||
@@ -200,20 +201,6 @@ async def _run_async(config):
|
||||
except Exception as e:
|
||||
logger.exception("websocket server failed to start: %s", e)
|
||||
|
||||
# Start the monitor thread as a background task
|
||||
try:
|
||||
monitor_task = asyncio.create_task(
|
||||
monitor_mod.start(
|
||||
config=config,
|
||||
hbdclass=hbdclass,
|
||||
pushmsg=pushmsg,
|
||||
msg_to_websockets=msg_to_websockets,
|
||||
)
|
||||
)
|
||||
logger.info("Monitor task started")
|
||||
except Exception as e:
|
||||
logger.exception("monitor task failed to start: %s", e)
|
||||
|
||||
try:
|
||||
# run forever until shutdown event is set
|
||||
await shutdown_event.wait()
|
||||
@@ -221,13 +208,6 @@ async def _run_async(config):
|
||||
except Exception as e:
|
||||
logger.exception("Error in main loop: %s", e)
|
||||
finally:
|
||||
# Clean up connection timers
|
||||
try:
|
||||
logger.info("Cleaning up connection timers...")
|
||||
await monitor_mod.cleanup_connections(hbdclass)
|
||||
except Exception as e:
|
||||
logger.warning("Error cleaning up connection timers: %s", e)
|
||||
|
||||
# Cancel all running tasks
|
||||
logger.info("Cancelling tasks...")
|
||||
try:
|
||||
@@ -235,7 +215,7 @@ async def _run_async(config):
|
||||
except Exception as e:
|
||||
logger.warning("Error closing UDP transport: %s", e)
|
||||
|
||||
tasks_to_cancel = [http_task, ws_task, monitor_task]
|
||||
tasks_to_cancel = [http_task, ws_task]
|
||||
for task in tasks_to_cancel:
|
||||
if task:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user