remove reboot during cooldown

This commit is contained in:
2026-03-20 11:00:12 +07:00
parent e2b7d93035
commit 0682019085
3 changed files with 41 additions and 55 deletions

View File

@@ -253,30 +253,15 @@ function perform_check!(st::State)
if in_cooldown
# During cooldown, track failures but don't trigger reboot yet
if success
broadcast_msg("Broadcasting from file: $thisFilePath")
logmsg("$ROUTER_IP is reachable during cooldown. Router is back online! Resetting state.")
st.consecutive_fails = 0
save_state(st, StateFilePath)
else
st.consecutive_fails += 1
broadcast_msg("Broadcasting from file: $thisFilePath")
logmsg("$ROUTER_IP is unreachable during cooldown. Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.")
save_state(st, StateFilePath)
# Check if we've reached threshold by now
if st.consecutive_fails >= FAILS_TO_REBOOT
logmsg("Cooldown has expired and router is still unreachable. Triggering reboot.")
ok = do_reboot()
if ok
thisFilePath = @__FILE__
broadcast_msg("Broadcasting from file: $thisFilePath")
logmsg("Reboot executed (or simulated). Resetting failure counter.")
st.consecutive_fails = 0
st.last_reboot_datetime = Dates.now()
save_state(st, StateFilePath)
else
logmsg("Reboot attempt failed; will retry after next interval.")
end
end
end
return
end
@@ -293,6 +278,7 @@ function perform_check!(st::State)
return
else
st.consecutive_fails += 1
broadcast_msg("Broadcasting from file: $thisFilePath")
logmsg("$ROUTER_IP is unreachable (last result: $routerresult). Consecutive fails: $(st.consecutive_fails)/$FAILS_TO_REBOOT.")
save_state(st, StateFilePath)
end