Commit c2743a29 authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-update.sh: detect partial route loss with 1% tolerance

Previously auto-recovery only triggered when routing table was completely empty. Now it also reloads when route count drops below 99% of expected (from resolved state file). Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent cc74595a
......@@ -229,6 +229,13 @@ process_routes()
elif [ "$route_count" = "0" ] ; then
need_reload=1
vlog "[$name]$label route table $table empty"
elif [ -f "$STATE_DIR/$state/resolved" ] ; then
local expected=$(wc -l < "$STATE_DIR/$state/resolved")
local threshold=$(( expected - expected / 100 ))
if [ "$route_count" -lt "$threshold" ] ; then
need_reload=1
vlog "[$name]$label route count $route_count < $threshold (expected $expected, 1% tolerance)"
fi
fi
if [ -n "$need_reload" ] ; then
log "[$name]$label Rules/routes lost, forcing reload"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment