fix: double volatile TTLs to survive missed scheduler runs
TTL = 2x refresh interval ensures data remains valid even if a scheduled refresh is delayed or fails. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+14
-13
@@ -38,20 +38,21 @@ class VolatileNamespace(str, Enum):
|
||||
|
||||
|
||||
# Default TTLs per namespace (in seconds)
|
||||
# TTL = 2x refresh interval to ensure data survives missed/delayed refreshes
|
||||
NAMESPACE_DEFAULT_TTL: Dict[str, int] = {
|
||||
VolatileNamespace.WEATHER: 3600, # 1 hour - current conditions
|
||||
VolatileNamespace.FORECAST: 43200, # 12 hours - forecast stable longer
|
||||
VolatileNamespace.SUN: 86400, # 24 hours - sun times change daily
|
||||
VolatileNamespace.NEWS: 3600, # 1 hour - news cycles
|
||||
VolatileNamespace.FINANCIAL: 300, # 5 min - markets move fast
|
||||
VolatileNamespace.TRANSIT: 300, # 5 min - schedules update frequently
|
||||
VolatileNamespace.TRAFFIC: 600, # 10 min - traffic patterns
|
||||
VolatileNamespace.AIR_QUALITY: 3600, # 1 hour - air quality stable
|
||||
VolatileNamespace.SPORTS: 60, # 1 min - live scores
|
||||
VolatileNamespace.SOCIAL: 600, # 10 min - social notifications
|
||||
VolatileNamespace.SYSTEM: 60, # 1 min - system health
|
||||
VolatileNamespace.CONTEXT: 3600, # 1 hour - session context
|
||||
VolatileNamespace.CUSTOM: 3600, # 1 hour - default for custom
|
||||
VolatileNamespace.WEATHER: 7200, # 2 hours (hourly refresh)
|
||||
VolatileNamespace.FORECAST: 86400, # 24 hours (12hr refresh)
|
||||
VolatileNamespace.SUN: 172800, # 48 hours (daily refresh)
|
||||
VolatileNamespace.NEWS: 7200, # 2 hours (hourly refresh)
|
||||
VolatileNamespace.FINANCIAL: 600, # 10 min (5 min refresh)
|
||||
VolatileNamespace.TRANSIT: 600, # 10 min (5 min refresh)
|
||||
VolatileNamespace.TRAFFIC: 1200, # 20 min (10 min refresh)
|
||||
VolatileNamespace.AIR_QUALITY: 7200, # 2 hours (hourly refresh)
|
||||
VolatileNamespace.SPORTS: 120, # 2 min (1 min refresh)
|
||||
VolatileNamespace.SOCIAL: 1200, # 20 min (10 min refresh)
|
||||
VolatileNamespace.SYSTEM: 120, # 2 min (1 min refresh)
|
||||
VolatileNamespace.CONTEXT: 7200, # 2 hours - session context
|
||||
VolatileNamespace.CUSTOM: 7200, # 2 hours - default for custom
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user