fix(server): restore keeps connectivity alert for connections dropped to unknown
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uc9V1v7iXruubpoLiSE24M
This commit is contained in:
+5
-1
@@ -351,6 +351,7 @@ def restore_connection_timers(hbdclass, ctx):
|
||||
restored += 1
|
||||
|
||||
elif state == hbdclass.Connection.OVERDUE:
|
||||
host_overdue = host.status() == "overdue"
|
||||
elapsed_overdue = now - conn.statetime
|
||||
remaining = DROPOVERDUE - elapsed_overdue
|
||||
if remaining <= 1:
|
||||
@@ -360,6 +361,9 @@ def restore_connection_timers(hbdclass, ctx):
|
||||
"Marking %s/%s UNKNOWN (overdue %.1f days)",
|
||||
uname, afam, elapsed_overdue / 86400,
|
||||
)
|
||||
# A connection dropped to UNKNOWN keeps its alert, like the
|
||||
# UNKNOWN branch above and on_unknown do.
|
||||
host_overdue = True
|
||||
else:
|
||||
conn.reset_overdue_timer(remaining, on_unknown)
|
||||
logger.debug(
|
||||
@@ -369,7 +373,7 @@ def restore_connection_timers(hbdclass, ctx):
|
||||
# Ensure the connectivity alert is set — it may be missing if
|
||||
# hbd was shut down before the on_overdue callback had a chance
|
||||
# to record it.
|
||||
if host.status() == "overdue":
|
||||
if host_overdue:
|
||||
_set_connectivity_alert(host, afam, "CRITICAL")
|
||||
restored += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user