Fix: Remove 'local' keyword from global scope (CRITICAL)
CRITICAL FIXES: - Line 164: Remove 'local' from memory_reduction variable (global scope) - Line 173: Remove 'local' from has_traffic variable (global scope) Issue: 'local' keyword can only be used inside function definitions. Using 'local' in global scope causes 'local: can only be used in a function' runtime error and script failure. RESULTS: - 2 CRITICAL issues fixed - Script now runs without global scope errors
This commit is contained in:
@@ -161,7 +161,7 @@ while IFS= read -r username; do
|
||||
# Determine if optimization needed
|
||||
# Flag as YES if: different from current (increase or decrease)
|
||||
# AND has meaningful traffic (>= 5 concurrent) OR memory efficiency gain (> 20% reduction)
|
||||
local memory_reduction=0
|
||||
memory_reduction=0
|
||||
if [ "$recommended" -lt "$current" ]; then
|
||||
memory_reduction=$(( (current - recommended) * 100 / current ))
|
||||
fi
|
||||
@@ -170,7 +170,7 @@ while IFS= read -r username; do
|
||||
# Check if change is meaningful:
|
||||
# 1. Has significant traffic (>= 5 concurrent requests)
|
||||
# 2. OR significant memory reduction (>= 20%)
|
||||
local has_traffic=0
|
||||
has_traffic=0
|
||||
[ "$peak" != "?" ] && [ "$peak" -ge 5 ] && has_traffic=1
|
||||
|
||||
if [ "$has_traffic" = "1" ] || [ "$memory_reduction" -ge 20 ]; then
|
||||
|
||||
Reference in New Issue
Block a user