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

@@ -581,8 +581,16 @@ class DisplayController:
# Defer sport manager updates that might do heavy API fetching
if hasattr(self, 'ncaa_fb_live') and self.ncaa_fb_live:
self.display_manager.defer_update(self.ncaa_fb_live.update, priority=3)
if hasattr(self, 'ncaa_fb_recent') and self.ncaa_fb_recent:
self.display_manager.defer_update(self.ncaa_fb_recent.update, priority=3)
if hasattr(self, 'ncaa_fb_upcoming') and self.ncaa_fb_upcoming:
self.display_manager.defer_update(self.ncaa_fb_upcoming.update, priority=3)
if hasattr(self, 'nfl_live') and self.nfl_live:
self.display_manager.defer_update(self.nfl_live.update, priority=3)
if hasattr(self, 'nfl_recent') and self.nfl_recent:
self.display_manager.defer_update(self.nfl_recent.update, priority=3)
if hasattr(self, 'nfl_upcoming') and self.nfl_upcoming:
self.display_manager.defer_update(self.nfl_upcoming.update, priority=3)
# Continue with non-scrolling-sensitive updates
if self.weather: self.weather.get_weather()
if self.calendar: self.calendar.update(time.time())