reduce logging for leaderboard dynamic duration

This commit is contained in:
Chuck
2025-09-12 15:13:13 -04:00
parent 6f894a587b
commit 4cfaa5ca59
2 changed files with 15 additions and 1 deletions

View File

@@ -519,6 +519,20 @@ class DisplayController:
# Fall back to configured duration # Fall back to configured duration
return self.display_durations.get(mode_key, 60) return self.display_durations.get(mode_key, 60)
# Handle dynamic duration for leaderboard
if mode_key == 'leaderboard' and self.leaderboard:
try:
dynamic_duration = self.leaderboard.get_dynamic_duration()
# Only log if duration has changed or we haven't logged this duration yet
if not hasattr(self, '_last_logged_leaderboard_duration') or self._last_logged_leaderboard_duration != dynamic_duration:
logger.info(f"Using dynamic duration for leaderboard: {dynamic_duration} seconds")
self._last_logged_leaderboard_duration = dynamic_duration
return dynamic_duration
except Exception as e:
logger.error(f"Error getting dynamic duration for leaderboard: {e}")
# Fall back to configured duration
return self.display_durations.get(mode_key, 60)
# Simplify weather key handling # Simplify weather key handling
if mode_key.startswith('weather_'): if mode_key.startswith('weather_'):
return self.display_durations.get(mode_key, 15) return self.display_durations.get(mode_key, 15)

View File

@@ -1055,7 +1055,7 @@ class LeaderboardManager:
logger.debug(f"Leaderboard enabled: {self.is_enabled}") logger.debug(f"Leaderboard enabled: {self.is_enabled}")
logger.debug(f"Current scroll position: {self.scroll_position}") logger.debug(f"Current scroll position: {self.scroll_position}")
logger.debug(f"Leaderboard image width: {self.leaderboard_image.width if self.leaderboard_image else 'None'}") logger.debug(f"Leaderboard image width: {self.leaderboard_image.width if self.leaderboard_image else 'None'}")
logger.info(f"Using dynamic duration for leaderboard: {self.dynamic_duration}s") logger.debug(f"Using dynamic duration for leaderboard: {self.dynamic_duration}s")
if not self.is_enabled: if not self.is_enabled:
logger.debug("Leaderboard is disabled, exiting display method.") logger.debug("Leaderboard is disabled, exiting display method.")