From 2598c5ac98e724fa6624c199e72e19721110be79 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Thu, 16 Apr 2026 17:18:19 +0800 Subject: [PATCH] Disable caching for city list updates --- frontend/app/api/cities/route.ts | 9 +++------ tests/test_country_networks.py | 4 ++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/app/api/cities/route.ts b/frontend/app/api/cities/route.ts index 6500b8f9..1c73c84a 100644 --- a/frontend/app/api/cities/route.ts +++ b/frontend/app/api/cities/route.ts @@ -21,12 +21,9 @@ export async function GET(req: NextRequest) { const auth = await buildBackendRequestHeaders(req, { includeSupabaseIdentity: false, }); - const fetchOptions = { - headers: auth.headers, - next: { revalidate: 300 }, - } as const; const res = await fetch(`${API_BASE}/api/cities`, { - ...fetchOptions, + headers: auth.headers, + cache: "no-store", }); if (!res.ok) { const raw = await res.text(); @@ -40,7 +37,7 @@ export async function GET(req: NextRequest) { const response = buildCachedJsonResponse( req, data, - "public, max-age=0, s-maxage=300, stale-while-revalidate=1800", + "no-store, max-age=0", ); return applyAuthResponseCookies(response, auth.response); } catch (error) { diff --git a/tests/test_country_networks.py b/tests/test_country_networks.py index 4107dde9..3600688d 100644 --- a/tests/test_country_networks.py +++ b/tests/test_country_networks.py @@ -1,6 +1,7 @@ from src.data_collection.country_networks import build_country_network_snapshot from src.data_collection.city_registry import ALIASES, CITY_REGISTRY from web.analysis_service import _build_city_detail_payload, _build_intraday_meteorology +from web.core import CITIES def test_new_south_asia_city_registry_entries_are_wired(): @@ -12,6 +13,9 @@ def test_new_south_asia_city_registry_entries_are_wired(): assert ALIASES["rpll"] == "manila" assert ALIASES["opkc"] == "karachi" assert ALIASES["opmr"] == "masroor air base" + assert CITIES["manila"]["lat"] == CITY_REGISTRY["manila"]["lat"] + assert CITIES["karachi"]["lon"] == CITY_REGISTRY["karachi"]["lon"] + assert CITIES["masroor air base"]["settlement_source"] == "metar" def test_turkey_mgm_provider_returns_official_nearby_rows():