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() ...@@ -552,19 +552,23 @@ resolve_list_file()
[ "$_bad" -gt 0 ] && log "$_tag$_label WARNING: filtered out $_bad invalid entries from DNS resolve" || true [ "$_bad" -gt 0 ] && log "$_tag$_label WARNING: filtered out $_bad invalid entries from DNS resolve" || true
rm -f "$_resolved_new.tmp" rm -f "$_resolved_new.tmp"
# Accumulate resolve history (DNS round-robin) # Accumulate resolve history (DNS round-robin) — only for lists with domains
local history_dir="$STATE_DIR/$_state/resolve_history" if grep -v '^#' "$_f" | grep -q '[a-zA-Z]' ; then
mkdir -p "$history_dir" local history_dir="$STATE_DIR/$_state/resolve_history"
rm -f "$history_dir/$HISTORY_SIZE" mkdir -p "$history_dir"
local i=$((HISTORY_SIZE - 1)) rm -f "$history_dir/$HISTORY_SIZE"
while [ $i -ge 1 ] ; do local i=$((HISTORY_SIZE - 1))
[ -f "$history_dir/$i" ] && mv "$history_dir/$i" "$history_dir/$((i + 1))" while [ $i -ge 1 ] ; do
i=$((i - 1)) [ -f "$history_dir/$i" ] && mv "$history_dir/$i" "$history_dir/$((i + 1))"
done i=$((i - 1))
cp "$_resolved_new" "$history_dir/1" done
sort -u "$history_dir"/* > "${_resolved_new}.merged" cp "$_resolved_new" "$history_dir/1"
mv "${_resolved_new}.merged" "$_resolved_new" sort -u "$history_dir"/* > "${_resolved_new}.merged"
vlog "$_tag$_label resolve history: $(ls "$history_dir" | wc -l) snapshots, $(wc -l < "$_resolved_new") unique IPs" 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) # Detect volatile domains (IPv4 and IPv6)
if grep -v '^#' "$_f" | grep -q '[a-zA-Z]' ; then 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