Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

fix(cctv): give Tarktee's slow DATEX feeds 30 s instead of the shared 15 s

quanticsoul47726b3f7a3ec11c
diff --git a/server/providers/cctv/constants.js b/server/providers/cctv/constants.js
index 20b963770..b0e768c83 100644
--- a/server/providers/cctv/constants.js
+++ b/server/providers/cctv/constants.js
@@ -439,6 +439,10 @@ export const CCTV_SOURCE_CACHE_MS = 15 * 60 * 1000;
* pending forever — a hung fetch aborts, the loader returns [], and
* serve-stale/other packs take over. */
export const CCTV_SOURCE_FETCH_TIMEOUT_MS = 15 * 1000;
+/** Tarktee's two DATEX feeds (120 and 160 KB) answered in 2 to 16.6 s across
+ * ten requests on 2026-10-18, so the shared 15 s timeout dropped the Estonian
+ * pack on about a third of loads. Both must arrive for any camera to load. */
+export const TARKTEE_FETCH_TIMEOUT_MS = 30 * 1000;
/** Individual CCTV image fetches must settle before the active 10-second
* client refresh cadence. A bounded miss can fall through to Street View or
* the synthetic frame instead of leaving the browser preview pending. */
diff --git a/server/providers/cctv/sources.js b/server/providers/cctv/sources.js
index c3d11e752..f9711ea0c 100644
--- a/server/providers/cctv/sources.js
+++ b/server/providers/cctv/sources.js
@@ -70,6 +70,7 @@ import {
TORONTO_GROUND_ELEVATION_M,
TORONTO_MAX_CATALOG_BYTES,
CCTV_SOURCE_FETCH_TIMEOUT_MS,
+ TARKTEE_FETCH_TIMEOUT_MS,
DELDOT_CCTV_URL,
DEFAULT_DELDOT_MAX_SOURCES,
DELDOT_ANCHORS,
@@ -1194,11 +1195,11 @@ export async function loadTarkteeSourcesFromDatex() {
const [locResp, imgResp] = await Promise.all([
fetch(TARKTEE_LOCATIONS_URL, {
headers: { Accept: 'application/xml,text/xml,*/*' },
- signal: AbortSignal.timeout(CCTV_SOURCE_FETCH_TIMEOUT_MS),
+ signal: AbortSignal.timeout(TARKTEE_FETCH_TIMEOUT_MS),
}),
fetch(TARKTEE_IMAGES_URL, {
headers: { Accept: 'application/xml,text/xml,*/*' },
- signal: AbortSignal.timeout(CCTV_SOURCE_FETCH_TIMEOUT_MS),
+ signal: AbortSignal.timeout(TARKTEE_FETCH_TIMEOUT_MS),
}),
]);
if (!locResp.ok) {
diff --git a/src/data/cctvEstonia.test.mjs b/src/data/cctvEstonia.test.mjs
index 7c0ebaba1..0d578a26c 100644
--- a/src/data/cctvEstonia.test.mjs
+++ b/src/data/cctvEstonia.test.mjs
@@ -2,9 +2,11 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
loadTallinnSourcesFromCatalog,
+ loadTarkteeSourcesFromDatex,
parseTarkteeDatexImages,
parseTarkteeDatexLocations,
} from '../../server/providers/cctv/sources.js';
+import { TARKTEE_FETCH_TIMEOUT_MS } from '../../server/providers/cctv/constants.js';
const SAMPLE_LOCATIONS_XML = `<?xml version="1.0" encoding="UTF-8"?>
<d2LogicalModel xmlns="http://datex2.eu/schema/2/2_0">
@@ -84,3 +86,27 @@ test('Tarktee DATEX image parser rejects non-official hosts', () => {
const images = parseTarkteeDatexImages(xml);
assert.equal(images.size, 0);
});
+
+test('Tarktee DATEX requests wait 30 s, past the slow answers measured live', async (t) => {
+ const timeouts = [];
+ const timeout = AbortSignal.timeout;
+ t.mock.method(AbortSignal, 'timeout', (ms) => {
+ timeouts.push(ms);
+ return timeout.call(AbortSignal, ms);
+ });
+ t.mock.method(console, 'log', () => {});
+ t.mock.method(
+ globalThis,
+ 'fetch',
+ async (url) =>
+ new Response(
+ String(url).includes('roadCameraLocations')
+ ? SAMPLE_LOCATIONS_XML
+ : SAMPLE_IMAGES_XML,
+ ),
+ );
+ const cameras = await loadTarkteeSourcesFromDatex();
+ assert.deepEqual(timeouts, [30_000, 30_000]);
+ assert.equal(TARKTEE_FETCH_TIMEOUT_MS, 30_000);
+ assert.equal(cameras.length, 1);
+});