mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 02:32:18 +00:00
Parse Lithuania catalogs inside the shared reader so bad JSON cancels the sibling
This commit is contained in:
1 parent
b6d5d7373f
commit
247452c202
3 files changed
+42
-38
No files matched your search
@@ -84,19 +84,18 @@ export function lithuaniaCameraToSource(row, feature) {
|
||||
/** Two bounded requests per shared catalog refresh, no API key required. */
|
||||
export async function loadLithuaniaSources() {
|
||||
try {
|
||||
const [rows, layers] = (
|
||||
await readCatalogsTogether(
|
||||
[
|
||||
{ url: LITHUANIA_CAMERAS_URL, label: 'cameras' },
|
||||
{ url: LITHUANIA_LOCATIONS_URL, label: 'locations' },
|
||||
],
|
||||
{
|
||||
accept: 'application/json',
|
||||
maxBytes: LITHUANIA_MAX_CATALOG_BYTES,
|
||||
timeoutMs: CCTV_SOURCE_FETCH_TIMEOUT_MS,
|
||||
},
|
||||
)
|
||||
).map((text) => JSON.parse(text));
|
||||
const [rows, layers] = await readCatalogsTogether(
|
||||
[
|
||||
{ url: LITHUANIA_CAMERAS_URL, label: 'cameras' },
|
||||
{ url: LITHUANIA_LOCATIONS_URL, label: 'locations' },
|
||||
],
|
||||
{
|
||||
accept: 'application/json',
|
||||
maxBytes: LITHUANIA_MAX_CATALOG_BYTES,
|
||||
timeoutMs: CCTV_SOURCE_FETCH_TIMEOUT_MS,
|
||||
parse: JSON.parse,
|
||||
},
|
||||
);
|
||||
if (!Array.isArray(rows) || !Array.isArray(layers)) return [];
|
||||
const features = layers.find((layer) => layer?.layer === 'VKR')?.features;
|
||||
if (!Array.isArray(features)) return [];
|
||||
|
||||
Reference in new issue
Block a user