FIX: Revert for-loop in auto-clear to explicit if statements
- for loop was causing slowdown in startup_detection() - Split into two explicit cache file checks instead - Maintains support for both .sysref and .sysref.beta - Restores instant startup speed
This commit is contained in:
+11
-10
@@ -691,17 +691,18 @@ init_directories() {
|
|||||||
startup_detection() {
|
startup_detection() {
|
||||||
# Auto-clear cache if toolkit files are newer (fresh git pull)
|
# Auto-clear cache if toolkit files are newer (fresh git pull)
|
||||||
# This ensures users always get fresh data after git updates
|
# This ensures users always get fresh data after git updates
|
||||||
# Handle both production (.sysref) and dev (.sysref.beta) cache names
|
if [ -f "$BASE_DIR/.sysref.beta" ] && [ -f "$BASE_DIR/launcher.sh" ]; then
|
||||||
local cache_file
|
if [ "$BASE_DIR/launcher.sh" -nt "$BASE_DIR/.sysref.beta" ]; then
|
||||||
for cache_file in "$BASE_DIR/.sysref.beta" "$BASE_DIR/.sysref"; do
|
rm -f "$BASE_DIR/.sysref.beta" "$BASE_DIR/.sysref.beta.timestamp" 2>/dev/null || true
|
||||||
if [ -f "$cache_file" ] && [ -f "$BASE_DIR/launcher.sh" ]; then
|
|
||||||
# If launcher.sh is newer than cache, it means git just pulled updates
|
|
||||||
# and we should rebuild cache with current code
|
|
||||||
if [ "$BASE_DIR/launcher.sh" -nt "$cache_file" ]; then
|
|
||||||
rm -f "$cache_file" "${cache_file}.timestamp" 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
fi
|
||||||
|
|
||||||
|
# Also check production cache name for backward compatibility
|
||||||
|
if [ -f "$BASE_DIR/.sysref" ] && [ -f "$BASE_DIR/launcher.sh" ]; then
|
||||||
|
if [ "$BASE_DIR/launcher.sh" -nt "$BASE_DIR/.sysref" ]; then
|
||||||
|
rm -f "$BASE_DIR/.sysref" "$BASE_DIR/.sysref.timestamp" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Initialize system detection first (required for show_system_overview)
|
# Initialize system detection first (required for show_system_overview)
|
||||||
if [ -z "${SYS_DETECTION_COMPLETE:-}" ]; then
|
if [ -z "${SYS_DETECTION_COMPLETE:-}" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user