fix(server): give the last six outbound fetches a timeout, and lint for it

Overpass, the Wikipedia photo lookup (which holds one of five shared
photo slots), the plugin download and registry, and the two API key
checks had no signal, so a provider that took the connection and went
quiet held the request for undici's 300 s default. ESLint now refuses a
fetch() whose init carries no signal.
This commit is contained in:
Maurice
2026-10-07 16:19:55 +02:00
parent a8fc93dfde
commit 7e8c9ac3a5
5 changed files with 46 additions and 4 deletions
+9 -1
View File
@@ -1469,6 +1469,9 @@ export class MapsService {
method: 'POST',
headers: { 'User-Agent': UA, 'Content-Type': 'application/x-www-form-urlencoded' },
body: `data=${encodeURIComponent(query)}`,
// The query asks Overpass for 5 s; a public instance that is overloaded
// takes the connection and then sits on it.
signal: AbortSignal.timeout(10_000),
});
if (!res.ok) return null;
const data = (await res.json()) as { elements?: OverpassElement[] };
@@ -1615,7 +1618,12 @@ export class MapsService {
pilimit: '1',
redirects: '1',
});
const res = await fetch(`https://en.wikipedia.org/w/api.php?${searchParams}`, { headers: { 'User-Agent': UA } });
const res = await fetch(`https://en.wikipedia.org/w/api.php?${searchParams}`, {
headers: { 'User-Agent': UA },
// This runs inside one of the few shared photo-fetch slots; a stalled
// answer would hold it for everyone.
signal: AbortSignal.timeout(WIKI_TIMEOUT_MS),
});
if (res.ok) {
const data = (await res.json()) as { query?: { pages?: Record<string, { thumbnail?: { source?: string } }> } };
const pages = data.query?.pages;