🍕 Sync 2026-09-17 11:06:12

This commit is contained in:
github-actions[bot] committed 2026-09-17 11:06:12 +08:00
1 parent 6bd796a758
commit 50871a0a18
10 files changed
+510 -48

No files matched your search

@@ -443,13 +443,14 @@ fwlive_adaptive_is_hot() {
# Merge adaptive siblings into a JSON object ending with }. A successful
# filter already carries the exact messages_received count; do not append a
# duplicate key in that case.
# Args: json_body shed_flag limit truncated messages_received
# Args: json_body shed_flag limit truncated messages_received success_flag
fwlive_adaptive_merge_reply() {
_body=$1
_shed=$2
_limit=$3
_trunc=$4
_msgs=$5
_success=${6:-0}
_adapt=1
fwlive_adaptive_enabled || _adapt=0
case "$_body" in
@@ -457,6 +458,8 @@ fwlive_adaptive_merge_reply() {
*) printf '%s' "$_body"; return 0 ;;
esac
_base=${_body%\}}
_effective=
[ "$_success" = 1 ] && _effective=",\"effective_limit\":$_limit"
_has_msgs=0
case "$_body" in
*',"messages_received":'*) _has_msgs=1 ;;
@@ -471,18 +474,18 @@ fwlive_adaptive_merge_reply() {
fi
if [ "$_shed" = 1 ]; then
if [ "$_has_msgs" = 1 ]; then
printf '%s,"adaptive":1,"truncated":%s,"shed":{"level":"hot","limit":%s}}' \
"$_base" "$_trunc" "$_limit"
printf '%s,"adaptive":1%s,"truncated":%s,"shed":{"level":"hot","limit":%s}}' \
"$_base" "$_effective" "$_trunc" "$_limit"
else
printf '%s,"adaptive":1,"messages_received":%s,"truncated":%s,"shed":{"level":"hot","limit":%s}}' \
"$_base" "$_msgs" "$_trunc" "$_limit"
printf '%s,"adaptive":1,"messages_received":%s%s,"truncated":%s,"shed":{"level":"hot","limit":%s}}' \
"$_base" "$_msgs" "$_effective" "$_trunc" "$_limit"
fi
else
if [ "$_has_msgs" = 1 ]; then
printf '%s,"adaptive":1,"truncated":%s}' "$_base" "$_trunc"
printf '%s,"adaptive":1%s,"truncated":%s}' "$_base" "$_effective" "$_trunc"
else
printf '%s,"adaptive":1,"messages_received":%s,"truncated":%s}' \
"$_base" "$_msgs" "$_trunc"
printf '%s,"adaptive":1,"messages_received":%s%s,"truncated":%s}' \
"$_base" "$_msgs" "$_effective" "$_trunc"
fi
fi
}
+2 -2
View File
@@ -440,7 +440,7 @@ fetch_firewall_logs() {
# Do not record ~0 ms as cold: failure is not healthy fast processing
# and must not clear an existing hot/shed cap (#329 Hermes Q1).
out='{"log":[],"error":"log_read_failed"}'
fwlive_adaptive_merge_reply "$out" "$shed_flag" "$lines" 0 0
fwlive_adaptive_merge_reply "$out" "$shed_flag" "$lines" 0 0 0
return 0
fi
@@ -486,7 +486,7 @@ fetch_firewall_logs() {
_trunc=0
[ "$shed_flag" = 1 ] && _trunc=1
[ "$lines" -lt "$requested" ] && _trunc=1
fwlive_adaptive_merge_reply "$out" "$shed_flag" "$lines" "$_trunc" 0
fwlive_adaptive_merge_reply "$out" "$shed_flag" "$lines" "$_trunc" 0 "$_filter_ok"
}
poll_logs() {