Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/scripts/check-production-line-limit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ declare -A GRANDFATHERED=(
# split is tracked there.
["pm-stack/aggregator/src/render.ts"]="#12671"
["pm-stack/aggregator/src/server.ts"]="#12671"
["pm-stack/aggregator/src/sources/live.ts"]="#12671"
# The id-worlds files below moved from pkgs/id/src/ to
# pkgs/id/crates/id-worlds/src/ in the id crate restructure; a key
# must name the file's CURRENT path or the entry silently stops
Expand Down
21 changes: 21 additions & 0 deletions pm-stack/aggregator/src/sources/http.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Shared JSON-over-HTTP helper for the live sources (split from live.ts
// for the production line limit, #12671).

export interface FetchResult {
ok: boolean;
json: unknown;
}

export async function getJson(
url: string,
headers: Record<string, string> = {},
init: RequestInit = {},
): Promise<FetchResult> {
try {
const res = await fetch(url, { headers, signal: AbortSignal.timeout(8000), ...init });
if (!res.ok) return { ok: false, json: { status: res.status } };
return { ok: true, json: await res.json() };
} catch (err) {
return { ok: false, json: { error: String(err) } };
}
}
Loading