mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Traffic roads come from OpenFreeMap vector tiles, or TomTom flow tiles with a key (Hybrid by default). Military areas use OpenFreeMap polygons with a bundled worldwide name index; wide views show named points. ALPR reads an hourly OpenStreetMap extract. Cockpit place context and country, state and US county outlines use bundled Natural Earth and US Census data. Overpass is used only when an operator configures their own endpoint. Also: camera arrivals no longer land below ground, keyless terrain retries on 429, bounded relation geometry for configured Overpass, one shared OpenStreetMap credit, and separate tile and API transports for embedders. Co-authored-by: theGaryLarson <[email protected]> Co-authored-by: Milan Khanal <[email protected]>
This commit is contained in:
200 files changed
+26665
-1977
No files matched your search
@@ -42,3 +42,55 @@ test('boundary throttle status survives empty or invalid error bodies', async ()
|
||||
assert.deepEqual(await services.boundaries.query('fixture'), { rateLimited: true, retryAfterMs: 5000 });
|
||||
}
|
||||
});
|
||||
|
||||
/** A transport whose status probe behaves as told; queries answer with no elements. */
|
||||
function probeTransport(status) {
|
||||
const seen = [];
|
||||
const fetchImpl = (url, init = {}) => {
|
||||
seen.push(`${init.method || 'GET'} ${url}`);
|
||||
if (!String(url).endsWith('/status')) return Promise.resolve(Response.json({ elements: [] }));
|
||||
return status(init);
|
||||
};
|
||||
return { seen, fetchImpl };
|
||||
}
|
||||
const stalled = (init) => new Promise((_, reject) => init.signal.addEventListener('abort', () => reject(init.signal.reason)));
|
||||
|
||||
test('a stalled capability probe times out and queries proceed; no re-probe during backoff', async () => {
|
||||
const { seen, fetchImpl } = probeTransport(stalled);
|
||||
const services = createApplicationRequestServices({ fetchImpl, boundaryProbe: { timeoutMs: 20, retryMs: 60_000 } });
|
||||
const started = Date.now();
|
||||
assert.deepEqual(await services.boundaries.query('fixture'), []);
|
||||
assert.ok(Date.now() - started < 1000);
|
||||
assert.deepEqual(await services.boundaries.query('fixture'), []);
|
||||
assert.deepEqual(seen, ['GET /api/overpass/status', 'POST /api/overpass', 'POST /api/overpass']);
|
||||
});
|
||||
|
||||
test('a caller cancelled while the probe is pending stops waiting at once', async () => {
|
||||
const { seen, fetchImpl } = probeTransport(stalled);
|
||||
const services = createApplicationRequestServices({ fetchImpl, boundaryProbe: { timeoutMs: 60_000, retryMs: 60_000 } });
|
||||
const caller = new AbortController();
|
||||
const pending = services.boundaries.query('fixture', { signal: caller.signal });
|
||||
setTimeout(() => caller.abort(), 10);
|
||||
await assert.rejects(pending, { name: 'AbortError' });
|
||||
assert.deepEqual(seen, ['GET /api/overpass/status']);
|
||||
});
|
||||
|
||||
test('a failed probe is retried after its backoff, not on every query', async () => {
|
||||
let failures = 1;
|
||||
const { seen, fetchImpl } = probeTransport(async () => {
|
||||
if (failures-- > 0) throw new TypeError('network');
|
||||
return Response.json({ configured: false });
|
||||
});
|
||||
const services = createApplicationRequestServices({ fetchImpl, boundaryProbe: { timeoutMs: 1000, retryMs: 30 } });
|
||||
assert.deepEqual(await services.boundaries.query('fixture'), []);
|
||||
assert.deepEqual(await services.boundaries.query('fixture'), []);
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
assert.equal((await services.boundaries.query('fixture')).code, 'OVERPASS_NOT_CONFIGURED');
|
||||
assert.equal((await services.boundaries.query('fixture')).code, 'OVERPASS_NOT_CONFIGURED');
|
||||
assert.deepEqual(seen, [
|
||||
'GET /api/overpass/status',
|
||||
'POST /api/overpass',
|
||||
'POST /api/overpass',
|
||||
'GET /api/overpass/status',
|
||||
]);
|
||||
});
|
||||
Reference in new issue
Block a user