From ce0590f0150e2fe9a0f42dbd90fb2f30bbb15d0f Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Sat, 2 May 2026 14:18:58 -0400 Subject: [PATCH] fix: suppress recover messages for down durations under 4 seconds Transient blips caused by hbc client restarts no longer generate eventlog entries or notifications. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- hbd/server/udp.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hbd/server/udp.py b/hbd/server/udp.py index 733db72..b5ad5ad 100644 --- a/hbd/server/udp.py +++ b/hbd/server/udp.py @@ -440,14 +440,18 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict): if not newh: if d == 0 or lasts == "unknown": m = "%s is up" % (conn.afam) + elif d < 4: + # Transient blip (likely client restart) — skip log and notification + m = None else: m = "%s back after being %s for %s" % (conn.afam, lasts, dur(d)) - eventlog(uname, "RECOVER", m) - if host.watched: - asyncio.create_task(notify_mod.send_notification( - uname, - notify_mod.Notification(title=f"[RECOVER] {uname}", body=m, level="RECOVER"), - )) + if m: + eventlog(uname, "RECOVER", m) + if host.watched: + asyncio.create_task(notify_mod.send_notification( + uname, + notify_mod.Notification(title=f"[RECOVER] {uname}", body=m, level="RECOVER"), + )) if boot or newh: host.upcount = host.doesack