Prevent watchdog from re-triggering departure on already-departing devices

Repeated watchdog calls for a device already in departing=True state
were feeding the churn suppressor, which misclassified the iPhone's IP
as infrastructure after 3 calls within 30 min. This blocked all
subsequent departure processing and caused a 31-min alert delay.

Fix: gate the on_departure() call on a should_depart flag set only when
the device is known and not already departing.
This commit is contained in:
Cobra
2026-04-14 20:40:09 -04:00
parent 319f11c1dc
commit c7eb1ee14f
+3 -4
View File
@@ -1787,13 +1787,12 @@ def personal_watchdog() -> None:
# Check if device is silent # Check if device is silent
if now - ts > WATCHDOG_TIMEOUT_SEC: if now - ts > WATCHDOG_TIMEOUT_SEC:
# Only fire if device is currently known and not already departing # Only fire if device is currently known and not already departing
# Don't hold lock when calling on_departure should_depart = False
with known_lock: with known_lock:
if mac in known_devices and not known_devices[mac].get('departing'): if mac in known_devices and not known_devices[mac].get('departing'):
# Copy the device info before releasing lock should_depart = True
dev_info = known_devices[mac].copy()
# Fire departure outside the lock if should_depart:
logging.info(f"Watchdog: personal device {mac} silent >{WATCHDOG_TIMEOUT_SEC}s, triggering departure") logging.info(f"Watchdog: personal device {mac} silent >{WATCHDOG_TIMEOUT_SEC}s, triggering departure")
on_departure(mac) on_departure(mac)