Fix odds ticker dynamic duration timing issue

- Modified get_dynamic_duration() to trigger update when total_scroll_width is 0
- This ensures the dynamic duration is calculated with actual data before being used
- Prevents fallback to minimum duration (30s) when odds ticker hasn't updated yet
- Added debug logging to track when updates are triggered for duration calculation
This commit is contained in:
ChuckBuilds
2025-08-18 19:13:54 -05:00
parent e4b3adb867
commit 3c1706d4e8

View File

@@ -1251,6 +1251,17 @@ class OddsTickerManager:
def get_dynamic_duration(self) -> int:
"""Get the calculated dynamic duration for display"""
# If we don't have a valid dynamic duration yet (total_scroll_width is 0),
# try to update the data first
if self.total_scroll_width == 0 and self.is_enabled:
logger.debug("get_dynamic_duration called but total_scroll_width is 0, attempting update...")
try:
# Force an update to get the data and calculate proper duration
self._perform_update()
except Exception as e:
logger.error(f"Error updating odds ticker for dynamic duration: {e}")
logger.debug(f"get_dynamic_duration called, returning: {self.dynamic_duration}s")
return self.dynamic_duration
def update(self):