29 lines
855 B
Python
29 lines
855 B
Python
"""Monitor helper for heartbeat daemon.
|
|
|
|
This module provides monitoring tasks for the heartbeat daemon.
|
|
The primary reachability monitoring is now event-driven (timers set/reset
|
|
on HTB arrival in udp.py) rather than periodic polling.
|
|
|
|
This module can be extended for additional monitoring tasks.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
import asyncio
|
|
import time
|
|
from . import notify as notify_mod
|
|
|
|
DROPOVERDUE = 7 * 24 * 3600
|
|
eventlog = notify_mod.eventlog
|
|
|
|
|
|
async def cleanup_connections(hbdclass):
|
|
"""Clean up connection timers on shutdown.
|
|
|
|
Cancels all active overdue timers to prevent callbacks after shutdown.
|
|
"""
|
|
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()
|
|
|