remove reboot during cooldown
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user