Commit 775d24e5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-update: skip history merge for IP-only lists

Resolve history accumulation (20 snapshots + sort -u) is only useful for domain lists where DNS round-robin returns different IPs each time. For IP/subnet-only lists (like antifilter-ip6 with 127k entries), every snapshot is identical, making the merge a waste of ~77 minutes. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 91b1d47f
......@@ -552,19 +552,23 @@ resolve_list_file()
[ "$_bad" -gt 0 ] && log "$_tag$_label WARNING: filtered out $_bad invalid entries from DNS resolve" || true
rm -f "$_resolved_new.tmp"
# Accumulate resolve history (DNS round-robin)
local history_dir="$STATE_DIR/$_state/resolve_history"
mkdir -p "$history_dir"
rm -f "$history_dir/$HISTORY_SIZE"
local i=$((HISTORY_SIZE - 1))
while [ $i -ge 1 ] ; do
[ -f "$history_dir/$i" ] && mv "$history_dir/$i" "$history_dir/$((i + 1))"
i=$((i - 1))
done
cp "$_resolved_new" "$history_dir/1"
sort -u "$history_dir"/* > "${_resolved_new}.merged"
mv "${_resolved_new}.merged" "$_resolved_new"
vlog "$_tag$_label resolve history: $(ls "$history_dir" | wc -l) snapshots, $(wc -l < "$_resolved_new") unique IPs"
# Accumulate resolve history (DNS round-robin) — only for lists with domains
if grep -v '^#' "$_f" | grep -q '[a-zA-Z]' ; then
local history_dir="$STATE_DIR/$_state/resolve_history"
mkdir -p "$history_dir"
rm -f "$history_dir/$HISTORY_SIZE"
local i=$((HISTORY_SIZE - 1))
while [ $i -ge 1 ] ; do
[ -f "$history_dir/$i" ] && mv "$history_dir/$i" "$history_dir/$((i + 1))"
i=$((i - 1))
done
cp "$_resolved_new" "$history_dir/1"
sort -u "$history_dir"/* > "${_resolved_new}.merged"
mv "${_resolved_new}.merged" "$_resolved_new"
vlog "$_tag$_label resolve history: $(ls "$history_dir" | wc -l) snapshots, $(wc -l < "$_resolved_new") unique IPs"
else
vlog "$_tag$_label IP-only list, skipping history merge"
fi
# Detect volatile domains (IPv4 and IPv6)
if grep -v '^#' "$_f" | grep -q '[a-zA-Z]' ; then
......
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