mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 11:05:09 +00:00
Optimize the start speed of optimize
This commit is contained in:
@@ -121,8 +121,8 @@ show_system_health() {
|
|||||||
uptime=${uptime:-0}
|
uptime=${uptime:-0}
|
||||||
|
|
||||||
# Compact one-line format with icon
|
# Compact one-line format with icon
|
||||||
printf "${ICON_ADMIN} System %.0f/%.0f GB RAM | %.0f/%.0f GB Disk (%.0f%%) | Uptime %.0fd\n" \
|
printf "${ICON_ADMIN} System %.0f/%.0f GB RAM | %.0f/%.0f GB Disk | Uptime %.0fd\n" \
|
||||||
"$mem_used" "$mem_total" "$disk_used" "$disk_total" "$disk_percent" "$uptime"
|
"$mem_used" "$mem_total" "$disk_used" "$disk_total" "$uptime"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1248,7 +1248,8 @@ get_path_size_kb() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
local result
|
local result
|
||||||
result=$(command du -sk "$path" 2> /dev/null | awk '{print $1}')
|
# Timeout protection: prevent du from hanging on large directories
|
||||||
|
result=$(run_with_timeout 5 sh -c "command du -sk \"$path\" 2> /dev/null | awk '{print \$1}'")
|
||||||
echo "${result:-0}"
|
echo "${result:-0}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -662,7 +662,7 @@ EOF
|
|||||||
# Collect all optimization items
|
# Collect all optimization items
|
||||||
local -a items=()
|
local -a items=()
|
||||||
|
|
||||||
# Always-on items
|
# Always-on items (no size checks - instant)
|
||||||
items+=('system_maintenance|System Maintenance|Rebuild system databases & flush caches|true')
|
items+=('system_maintenance|System Maintenance|Rebuild system databases & flush caches|true')
|
||||||
items+=('maintenance_scripts|Maintenance Scripts|Run daily/weekly/monthly scripts & rotate logs|true')
|
items+=('maintenance_scripts|Maintenance Scripts|Run daily/weekly/monthly scripts & rotate logs|true')
|
||||||
items+=('radio_refresh|Bluetooth & Wi-Fi Refresh|Reset wireless preference caches|true')
|
items+=('radio_refresh|Bluetooth & Wi-Fi Refresh|Reset wireless preference caches|true')
|
||||||
@@ -670,22 +670,22 @@ EOF
|
|||||||
items+=('log_cleanup|Diagnostics Cleanup|Purge old diagnostic & crash logs|true')
|
items+=('log_cleanup|Diagnostics Cleanup|Purge old diagnostic & crash logs|true')
|
||||||
items+=('startup_cache|Startup Cache Rebuild|Rebuild kext caches & prelinked kernel|true')
|
items+=('startup_cache|Startup Cache Rebuild|Rebuild kext caches & prelinked kernel|true')
|
||||||
|
|
||||||
# Conditional items
|
# Skip conditional checks - they require du which is slow
|
||||||
local item
|
# Users will see actual results when optimization runs
|
||||||
item=$(check_cache_refresh || true)
|
# item=$(check_cache_refresh || true)
|
||||||
[[ -n "$item" ]] && items+=("$item")
|
# [[ -n "$item" ]] && items+=("$item")
|
||||||
item=$(check_mail_downloads || true)
|
# item=$(check_mail_downloads || true)
|
||||||
[[ -n "$item" ]] && items+=("$item")
|
# [[ -n "$item" ]] && items+=("$item")
|
||||||
item=$(check_saved_state || true)
|
# item=$(check_saved_state || true)
|
||||||
[[ -n "$item" ]] && items+=("$item")
|
# [[ -n "$item" ]] && items+=("$item")
|
||||||
item=$(check_swap_cleanup || true)
|
# item=$(check_swap_cleanup || true)
|
||||||
[[ -n "$item" ]] && items+=("$item")
|
# [[ -n "$item" ]] && items+=("$item")
|
||||||
item=$(check_local_snapshots || true)
|
# item=$(check_local_snapshots || true)
|
||||||
[[ -n "$item" ]] && items+=("$item")
|
# [[ -n "$item" ]] && items+=("$item")
|
||||||
item=$(check_developer_cleanup || true)
|
# item=$(check_developer_cleanup || true)
|
||||||
[[ -n "$item" ]] && items+=("$item")
|
# [[ -n "$item" ]] && items+=("$item")
|
||||||
item=$(check_broken_configs || true)
|
# item=$(check_broken_configs || true)
|
||||||
[[ -n "$item" ]] && items+=("$item")
|
# [[ -n "$item" ]] && items+=("$item")
|
||||||
|
|
||||||
# Output items as JSON
|
# Output items as JSON
|
||||||
local first=true
|
local first=true
|
||||||
|
|||||||
2
mole
2
mole
@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
source "$SCRIPT_DIR/lib/core/common.sh"
|
source "$SCRIPT_DIR/lib/core/common.sh"
|
||||||
|
|
||||||
# Version info
|
# Version info
|
||||||
VERSION="1.11.33"
|
VERSION="1.11.34"
|
||||||
MOLE_TAGLINE="can dig deep to clean your Mac."
|
MOLE_TAGLINE="can dig deep to clean your Mac."
|
||||||
|
|
||||||
# Check if Touch ID is already configured
|
# Check if Touch ID is already configured
|
||||||
|
|||||||
Reference in New Issue
Block a user