mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
type error fix : remote ttl
This commit is contained in:
@@ -376,7 +376,11 @@ class CacheManager:
|
||||
|
||||
def set(self, key: str, data: Dict) -> None:
|
||||
"""Store data in cache with current timestamp."""
|
||||
self.save_cache(key, data)
|
||||
cache_data = {
|
||||
'data': data,
|
||||
'timestamp': time.time()
|
||||
}
|
||||
self.save_cache(key, cache_data)
|
||||
|
||||
def setup_persistent_cache(self) -> bool:
|
||||
"""
|
||||
|
||||
@@ -334,7 +334,7 @@ class OddsTickerManager:
|
||||
else:
|
||||
ttl = 43200 # 12 hours for future dates
|
||||
|
||||
data = self.cache_manager.get(cache_key)
|
||||
data = self.cache_manager.get(cache_key, max_age=ttl)
|
||||
|
||||
if data is None:
|
||||
url = f"https://site.api.espn.com/apis/site/v2/sports/{sport}/{league}/scoreboard?dates={date}"
|
||||
@@ -342,7 +342,7 @@ class OddsTickerManager:
|
||||
response = requests.get(url, timeout=self.request_timeout)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
self.cache_manager.set(cache_key, data, ttl=ttl)
|
||||
self.cache_manager.set(cache_key, data)
|
||||
logger.debug(f"Cached scoreboard for {league} on {date} with a TTL of {ttl} seconds.")
|
||||
else:
|
||||
logger.debug(f"Using cached scoreboard data for {league} on {date}.")
|
||||
|
||||
Reference in New Issue
Block a user