fix(rates): reduce cache TTL, expose fallback header and show stale data warning

This commit is contained in:
2026-03-09 18:17:01 +01:00
parent 1f86a5ead4
commit 10493826bf
4 changed files with 31 additions and 6 deletions

View File

@@ -1,9 +1,9 @@
import { fetchUnifiedRates } from "@/lib/api/normalize";
import type { RatesResponse } from "@/lib/rates";
export const RATES_CACHE_TTL_MS = 300_000;
export const RATES_CACHE_TTL_MS = 60_000;
export const RATES_CACHE_CONTROL_VALUE =
"s-maxage=300, stale-while-revalidate=1800";
"s-maxage=60, stale-while-revalidate=600";
let cachedRates: RatesResponse | null = null;
let cacheTimestamp = 0;