Reduce exchange rate refresh to twice daily

Be respectful of the free Frankfurter API — ECB rates only update once
a day anyway, so a 12-hour cache TTL is more than sufficient.

https://claude.ai/code/session_01LPpSZFfyh6vdV5HGFWjoQX
This commit is contained in:
Claude
2026-02-28 00:56:21 +00:00
parent 8277cf37e2
commit 6fdbc9f9a0
2 changed files with 3 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
"""Currency conversion using the Frankfurter API (ECB rates, no API key required).
Rates are cached in memory and refreshed at most once per hour.
Rates are cached in memory and refreshed at most twice per day.
"""
import logging
@@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
FRANKFURTER_URL = "https://api.frankfurter.dev/v1/latest"
TARGET_CURRENCIES = ("CAD", "EUR", "GBP")
CACHE_TTL_SECONDS = 3600 # 1 hour
CACHE_TTL_SECONDS = 43200 # 12 hours — be nice to the free service
# Module-level cache
_rates: dict[str, float] = {}