Disable caching for city list updates

This commit is contained in:
2569718930@qq.com
2026-04-16 17:18:19 +08:00
parent e2cb0cfe5e
commit 2598c5ac98
2 changed files with 7 additions and 6 deletions
+3 -6
View File
@@ -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) {
+4
View File
@@ -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():