Strip trailing whitespace, drop unused imports/variables/global statements, split multi-imports, fix E3xx/E1xx spacing and E712 comparisons. No behaviour change; only E501 long lines remain in flake8. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
26 lines
822 B
Python
26 lines
822 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
|
|
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()
|