fix bogus notification on new clients
This commit is contained in:
@@ -426,6 +426,13 @@ async def _run_async(config, config_path=None):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Error stopping DNS worker: %s", e)
|
logger.warning("Error stopping DNS worker: %s", e)
|
||||||
|
|
||||||
|
# Save state (hosts + sessions) on clean shutdown
|
||||||
|
try:
|
||||||
|
save_state(config, hbdclass)
|
||||||
|
logger.info("State saved on shutdown")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Error saving state on shutdown: %s", e)
|
||||||
|
|
||||||
logger.info("All tasks cancelled")
|
logger.info("All tasks cancelled")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+10
-7
@@ -412,13 +412,16 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict):
|
|||||||
if conn.getstate() != hbdcls.Connection.UP:
|
if conn.getstate() != hbdcls.Connection.UP:
|
||||||
lasts = conn.state
|
lasts = conn.state
|
||||||
d = conn.newstate(hbdcls.Connection.UP, now)
|
d = conn.newstate(hbdcls.Connection.UP, now)
|
||||||
if d == 0 or lasts == "unknown":
|
# Don't log/notify RECOVER for a brand-new host seen for the first time —
|
||||||
m = "%s is up" % (conn.afam)
|
# it was never down, it just hasn't been seen before.
|
||||||
else:
|
if not newh:
|
||||||
m = "%s back after being %s for %s" % (conn.afam, lasts, dur(d))
|
if d == 0 or lasts == "unknown":
|
||||||
eventlog(uname, "RECOVER", m)
|
m = "%s is up" % (conn.afam)
|
||||||
if uname in watchhosts:
|
else:
|
||||||
notify_mod.pushmsg_for_host(uname, "%s %s is back" % (uname, conn.afam))
|
m = "%s back after being %s for %s" % (conn.afam, lasts, dur(d))
|
||||||
|
eventlog(uname, "RECOVER", m)
|
||||||
|
if uname in watchhosts:
|
||||||
|
notify_mod.pushmsg_for_host(uname, "%s %s is back" % (uname, conn.afam))
|
||||||
|
|
||||||
if boot or newh:
|
if boot or newh:
|
||||||
host.upcount = host.doesack
|
host.upcount = host.doesack
|
||||||
|
|||||||
Reference in New Issue
Block a user