Fix nfl live update interval (#50)

* Fix NFL live update interval not being respected

- Add NFL managers to _update_modules() method in display_controller.py
- NFL managers now update continuously in background instead of only when displayed
- Fixes issue where NFL live data would only fetch once and never update
- NFL live manager now properly respects 30-second live_update_interval setting
- Also add NFL managers to deferred updates when display is scrolling

* Fix NFL Recent and Upcoming managers to use correct update intervals

- NFL Recent Manager now uses recent_update_interval (3600 seconds) instead of hardcoded 300
- NFL Upcoming Manager now uses upcoming_update_interval (3600 seconds) instead of hardcoded 300
- Ensures proper update intervals: Live=30s, Recent=3600s, Upcoming=3600s
- All managers respect their respective config intervals

* Fix NCAAFB managers to use correct update intervals and add to background updates

- NCAAFB Recent Manager now uses recent_update_interval (3600 seconds) instead of hardcoded 300
- NCAAFB Upcoming Manager now uses upcoming_update_interval (3600 seconds) instead of hardcoded 300
- Add NCAAFB managers to _update_modules() method in display_controller.py
- NCAAFB managers now update continuously in background instead of only when displayed
- Add NCAAFB managers to deferred updates when display is scrolling
- Ensures proper update intervals: Live=30s, Recent=3600s, Upcoming=3600s

* Fix NFL live manager to use cached data for fresh updates

- Change NFL Live Manager to use cache=True instead of cache=False
- NFL Live Manager was bypassing cache and not getting fresh data from background service
- Background service fetches and caches data, but live manager was ignoring the cache
- This fixes the issue where NFL live display shows stale data despite successful background fetches
- Live manager now gets fresh data from the background service cache

* Fix NFL live manager to force fresh data fetch when update interval passes

- NFL Live Manager now forces fresh fetch when update interval (30s) has passed
- Uses cache for immediate response but bypasses cache for fresh updates
- Adds logging to show when fresh fetch is forced
- This ensures live game data updates every 30 seconds with fresh scores/clock
- Fixes issue where live display was showing stale data despite background fetches

* Fix NFL live manager to always fetch fresh data from API

- NFL Live Manager now always fetches fresh data directly from ESPN API
- No cache usage for live games - ensures real-time scores and clock updates
- Live games should always show the latest information, not cached data
- This ensures live display updates every 30 seconds with current game state

* Fix NFL live manager to use synchronous API fetch for real-time updates

- NFL Live Manager now uses _fetch_nfl_api_data_sync() for direct API calls
- Bypasses background service and cache for immediate fresh data
- Ensures live games get real-time scores and clock updates every 30 seconds
- Direct API calls are faster and more reliable for live game data

* Fix NFL live manager to fetch only current games instead of entire season

- Create _fetch_current_nfl_games() method for live updates
- Only fetches current week's games, not entire 2025 season (335 events)
- Much faster API calls - only gets relevant live games
- Reduces API load and improves performance for live updates
- NFL Live Manager now fetches ~10-15 current games instead of 335 season games

* ensure live games aren't pulling whole season

* bugbot catches
This commit is contained in:
Chuck
2025-09-18 23:29:11 -04:00
committed by GitHub
parent 9dc1118d79
commit 86049ca679
3 changed files with 31 additions and 5 deletions

View File

@@ -1193,7 +1193,7 @@ class NCAAFBRecentManager(BaseNCAAFBManager): # Renamed class
self.games_list = [] # Filtered list for display (favorite teams)
self.current_game_index = 0
self.last_update = 0
self.update_interval = 300 # Check for recent games every 5 mins
self.update_interval = self.ncaa_fb_config.get("recent_update_interval", 3600) # Check for recent games every hour
self.last_game_switch = 0
self.game_display_duration = 15 # Display each recent game for 15 seconds
self.logger.info(f"Initialized NCAAFBRecentManager with {len(self.favorite_teams)} favorite teams") # Changed log prefix
@@ -1492,7 +1492,7 @@ class NCAAFBUpcomingManager(BaseNCAAFBManager): # Renamed class
self.games_list = [] # Filtered list for display (favorite teams)
self.current_game_index = 0
self.last_update = 0
self.update_interval = 300 # Check for upcoming games every 5 mins
self.update_interval = self.ncaa_fb_config.get("upcoming_update_interval", 3600) # Check for upcoming games every hour
self.last_log_time = 0
self.log_interval = 300
self.last_warning_time = 0