Disable caching for city list updates
This commit is contained in:
@@ -21,12 +21,9 @@ export async function GET(req: NextRequest) {
|
|||||||
const auth = await buildBackendRequestHeaders(req, {
|
const auth = await buildBackendRequestHeaders(req, {
|
||||||
includeSupabaseIdentity: false,
|
includeSupabaseIdentity: false,
|
||||||
});
|
});
|
||||||
const fetchOptions = {
|
|
||||||
headers: auth.headers,
|
|
||||||
next: { revalidate: 300 },
|
|
||||||
} as const;
|
|
||||||
const res = await fetch(`${API_BASE}/api/cities`, {
|
const res = await fetch(`${API_BASE}/api/cities`, {
|
||||||
...fetchOptions,
|
headers: auth.headers,
|
||||||
|
cache: "no-store",
|
||||||
});
|
});
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
const raw = await res.text();
|
const raw = await res.text();
|
||||||
@@ -40,7 +37,7 @@ export async function GET(req: NextRequest) {
|
|||||||
const response = buildCachedJsonResponse(
|
const response = buildCachedJsonResponse(
|
||||||
req,
|
req,
|
||||||
data,
|
data,
|
||||||
"public, max-age=0, s-maxage=300, stale-while-revalidate=1800",
|
"no-store, max-age=0",
|
||||||
);
|
);
|
||||||
return applyAuthResponseCookies(response, auth.response);
|
return applyAuthResponseCookies(response, auth.response);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from src.data_collection.country_networks import build_country_network_snapshot
|
from src.data_collection.country_networks import build_country_network_snapshot
|
||||||
from src.data_collection.city_registry import ALIASES, CITY_REGISTRY
|
from src.data_collection.city_registry import ALIASES, CITY_REGISTRY
|
||||||
from web.analysis_service import _build_city_detail_payload, _build_intraday_meteorology
|
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():
|
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["rpll"] == "manila"
|
||||||
assert ALIASES["opkc"] == "karachi"
|
assert ALIASES["opkc"] == "karachi"
|
||||||
assert ALIASES["opmr"] == "masroor air base"
|
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():
|
def test_turkey_mgm_provider_returns_official_nearby_rows():
|
||||||
|
|||||||
Reference in New Issue
Block a user