mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
Fix/odds ticker manager log spam (#65)
* fix(odds-ticker): Reduce log spam from insufficient time warnings - Add _insufficient_time_warning_logged flag to prevent repeated warnings - Log insufficient time warning only once per display session - Reset warning flag when starting new display or updating data - Maintain debug logging for scroll position resets to aid debugging This addresses the frequent 'Not enough time to complete content display' warnings that were flooding the logs every few milliseconds. * fix(leaderboard): Reduce log spam from progress and FPS logging - Change progress logging from every 50 pixels to every 5 seconds - Increase FPS logging interval from 10 seconds to 30 seconds - Add progress_log_interval and last_progress_log_time variables - Reset progress log timer when starting new display sessions or updating data - Maintain debug capability while significantly reducing log volume This addresses the frequent 'Leaderboard progress' and 'Leaderboard FPS' messages that were flooding the logs during leaderboard scrolling. * fix(music): Reduce log spam from track update logging - Add throttling mechanism for track update logging - Log track updates only when track title changes or after 5 seconds - Track last_logged_track_title and last_track_log_time to prevent spam - Maintain debug logging for throttled updates - Apply throttling to both regular updates and first valid data logging This addresses the frequent 'Track info updated' messages that were flooding the logs every few hundred milliseconds for the same track. * fix(logo-downloader): Fix TA&M filename normalization issue - Add special case for TA&M to keep as TA&M instead of converting to TAANDM - This fixes the issue where code was looking for TAANDM.png instead of TA&M.png - The actual logo file exists as TA&M.png, so normalization was causing file not found errors - Prevents unnecessary download attempts and permission errors for existing files Fixes the error: 'Logo not found for TA&M at assets/sports/ncaa_logos/TAANDM.png' * fix(logo-downloader): Implement robust filename variation handling - Add get_logo_filename_variations() method to handle multiple filename formats - Update _load_and_resize_logo() to try filename variations before downloading - Handles cases like TA&M.png vs TAANDM.png gracefully - Maintains backward compatibility with existing normalized filenames - Prevents issues with special characters in filenames while supporting existing files This addresses the ampersand filename issue more robustly by: 1. First trying the original filename (TA&M.png) 2. Falling back to normalized filename (TAANDM.png) if needed 3. Only attempting downloads if no variations exist * fix(leaderboard): Reduce log spam from end reached messages - Add _end_reached_logged flag to prevent repeated end reached warnings - Log 'Leaderboard reached end' and 'scrolling stopped' messages only once per display session - Maintain debug logging for throttled messages to aid debugging - Reset flag when starting new display sessions or updating data - Apply same throttling pattern used in odds ticker manager This addresses the frequent 'Leaderboard reached end' and 'scrolling stopped' messages that were flooding the logs every few milliseconds when at the end.
This commit is contained in:
@@ -56,9 +56,16 @@ class LeaderboardManager:
|
||||
# FPS tracking variables
|
||||
self.frame_times = [] # Store last 30 frame times for averaging
|
||||
self.last_frame_time = 0
|
||||
self.fps_log_interval = 10.0 # Log FPS every 10 seconds
|
||||
self.fps_log_interval = 30.0 # Log FPS every 30 seconds (increased from 10s)
|
||||
self.last_fps_log_time = 0
|
||||
|
||||
# Progress logging throttling
|
||||
self.progress_log_interval = 5.0 # Log progress every 5 seconds instead of every 50 pixels
|
||||
self.last_progress_log_time = 0
|
||||
|
||||
# End reached logging throttling
|
||||
self._end_reached_logged = False
|
||||
|
||||
# Initialize managers
|
||||
self.cache_manager = CacheManager()
|
||||
# Store reference to config instead of creating new ConfigManager
|
||||
@@ -1259,6 +1266,10 @@ class LeaderboardManager:
|
||||
try:
|
||||
self.leaderboard_data = self._fetch_all_standings()
|
||||
self.last_update = current_time
|
||||
# Reset progress logging timer when updating data
|
||||
self.last_progress_log_time = 0
|
||||
# Reset end reached logging flag when updating data
|
||||
self._end_reached_logged = False
|
||||
|
||||
if self.leaderboard_data:
|
||||
self._create_leaderboard_image()
|
||||
@@ -1313,6 +1324,10 @@ class LeaderboardManager:
|
||||
logger.debug(f"Reset/initialized display start time: {self._display_start_time}")
|
||||
# Also reset scroll position for clean start
|
||||
self.scroll_position = 0
|
||||
# Reset progress logging timer
|
||||
self.last_progress_log_time = 0
|
||||
# Reset end reached logging flag
|
||||
self._end_reached_logged = False
|
||||
else:
|
||||
# Check if the display start time is too old (more than 2x the dynamic duration)
|
||||
current_time = time.time()
|
||||
@@ -1321,6 +1336,10 @@ class LeaderboardManager:
|
||||
logger.debug(f"Display start time is too old ({elapsed_time:.1f}s), resetting")
|
||||
self._display_start_time = current_time
|
||||
self.scroll_position = 0
|
||||
# Reset progress logging timer
|
||||
self.last_progress_log_time = 0
|
||||
# Reset end reached logging flag
|
||||
self._end_reached_logged = False
|
||||
|
||||
logger.debug(f"Number of leagues in data at start of display method: {len(self.leaderboard_data)}")
|
||||
if not self.leaderboard_data:
|
||||
@@ -1382,11 +1401,17 @@ class LeaderboardManager:
|
||||
else:
|
||||
# Stop scrolling when we reach the end
|
||||
if self.scroll_position >= self.leaderboard_image.width - width:
|
||||
logger.info(f"Leaderboard reached end: scroll_position {self.scroll_position} >= {self.leaderboard_image.width - width}")
|
||||
# Only log this message once per display session to avoid spam
|
||||
if not self._end_reached_logged:
|
||||
logger.info(f"Leaderboard reached end: scroll_position {self.scroll_position} >= {self.leaderboard_image.width - width}")
|
||||
logger.info("Leaderboard scrolling stopped - reached end of content")
|
||||
self._end_reached_logged = True
|
||||
else:
|
||||
logger.debug(f"Leaderboard reached end (throttled): scroll_position {self.scroll_position} >= {self.leaderboard_image.width - width}")
|
||||
|
||||
self.scroll_position = self.leaderboard_image.width - width
|
||||
# Signal that scrolling has stopped
|
||||
self.display_manager.set_scrolling_state(False)
|
||||
logger.info("Leaderboard scrolling stopped - reached end of content")
|
||||
if self.time_over == 0:
|
||||
self.time_over = time.time()
|
||||
elif time.time() - self.time_over >= 2:
|
||||
@@ -1397,9 +1422,10 @@ class LeaderboardManager:
|
||||
elapsed_time = current_time - self._display_start_time
|
||||
remaining_time = self.dynamic_duration - elapsed_time
|
||||
|
||||
# Log scroll progress every 50 pixels to help debug (less verbose)
|
||||
if self.scroll_position % 50 == 0 and self.scroll_position > 0:
|
||||
# Log scroll progress every 5 seconds to help debug (throttled to reduce spam)
|
||||
if current_time - self.last_progress_log_time >= self.progress_log_interval and self.scroll_position > 0:
|
||||
logger.info(f"Leaderboard progress: elapsed={elapsed_time:.1f}s, remaining={remaining_time:.1f}s, scroll_pos={self.scroll_position}/{self.leaderboard_image.width}px")
|
||||
self.last_progress_log_time = current_time
|
||||
|
||||
# If we have less than 2 seconds remaining, check if we can complete the content display
|
||||
if remaining_time < 2.0 and self.scroll_position > 0:
|
||||
|
||||
Reference in New Issue
Block a user