fix locale cache
This commit is contained in:
@@ -36,7 +36,7 @@ export async function GET(request: NextRequest) {
|
||||
|
||||
let fifaData: Awaited<ReturnType<typeof fetchFifaScores>>;
|
||||
try {
|
||||
fifaData = await fetchFifaScores(locale);
|
||||
fifaData = await fetchFifaScores();
|
||||
} catch {
|
||||
return NextResponse.json({
|
||||
updatedAt: new Date().toISOString(),
|
||||
|
||||
10
lib/feeds.ts
10
lib/feeds.ts
@@ -575,13 +575,13 @@ export async function fetchMatchesAndTeamsFifa(locale: string = "de"): Promise<{
|
||||
}
|
||||
|
||||
// Holt Live-Scores von der FIFA-API. Gibt Map MatchNumber → Scores + FIFA-ID→App-Code-Map zurück.
|
||||
export async function fetchFifaScores(locale: string = "de"): Promise<{
|
||||
// Scores/Status/Penalties/Winner sind sprachunabhängig → locale-freier Cache-Key.
|
||||
export async function fetchFifaScores(): Promise<{
|
||||
scores: Map<number, FifaScores>;
|
||||
fifaIdToAppCode: Map<string, string>;
|
||||
}> {
|
||||
return cached(`fifa:scores:${locale}`, 45_000, async () => {
|
||||
const lang = locale === "en" ? "en" : "de";
|
||||
const url = `${FIFA_BASE}/calendar/matches?language=${lang}&count=500&idSeason=${FIFA_SEASON}`;
|
||||
return cached("fifa:scores", 45_000, async () => {
|
||||
const url = `${FIFA_BASE}/calendar/matches?language=en&count=500&idSeason=${FIFA_SEASON}`;
|
||||
const res = await fetch(url, {
|
||||
cache: "no-store",
|
||||
headers: { "User-Agent": "wm2026-board/1.0" },
|
||||
@@ -773,7 +773,7 @@ export async function attachFifaLiveData(
|
||||
// --- Step 1: Scores von FIFA holen ---
|
||||
let fifaData: Awaited<ReturnType<typeof fetchFifaScores>>;
|
||||
try {
|
||||
fifaData = await fetchFifaScores(locale);
|
||||
fifaData = await fetchFifaScores();
|
||||
} catch (err) {
|
||||
console.warn("[fifa-fetch] Scores fehlgeschlagen:", err instanceof Error ? err.message : err);
|
||||
return matches;
|
||||
|
||||
Reference in New Issue
Block a user