diff --git a/app/page.tsx b/app/page.tsx
index 7fa1765..d59bd11 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -599,10 +599,10 @@ export default function Dashboard() {
- {label && (
-
- {label}
-
- )}
+
{
+ try {
+ const raw = readFileSync(IL_CACHE_FILE, "utf8");
+ const cached = JSON.parse(raw) as { ts: number; data: ILExpectationsWithHistory };
+ if (Date.now() - cached.ts < IL_CACHE_TTL) {
+ console.log(`[IL-cache] HIT (${Math.round((Date.now() - cached.ts) / 60000)}min old)`);
+ return cached.data;
+ }
+ console.log("[IL-cache] STALE — refetch");
+ } catch {
+ console.log("[IL-cache] MISS — premier fetch");
+ }
+ const data = await fetchILExpectationsWithHistory();
+ try {
+ writeFileSync(IL_CACHE_FILE, JSON.stringify({ ts: Date.now(), data }));
+ } catch { /* /tmp read-only en prod Vercel — ignoré */ }
+ return data;
+}
// ── Types publics ──────────────────────────────────────────────────────────────
@@ -291,7 +315,7 @@ function parseCBBody(ccy: Currency, body: Record): CBRatePath |
export async function fetchAllCBPaths(): Promise {
// GitHub Actions met à jour data/rate-probabilities.json toutes les heures
// (CME FedWatch pour USD, Investing.com pour les autres, InvestingLive en fallback)
- const [ilHistory] = await Promise.all([fetchILExpectationsWithHistory()]);
+ const [ilHistory] = await Promise.all([getCachedILHistory()]);
const ilData = ilHistory.current;
const ilPrev = ilHistory.prev;
const prevDate = ilHistory.prevDate;