mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 11:24:00 +00:00
fix(street-level): probe KartaView's nearest photos side by side
Six candidates at once on photo storage (not the API host): the nearest showable one wins. Jakarta line clicks opened 5/8 (0/5 before the QA round; the rest are archived and say so), Detroit 8/8. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
454e261256
commit
1a2fbda464
2 files changed
+10
-4
No files matched your search
@@ -440,8 +440,14 @@ export function createKartaViewProvider({
|
|||||||
if (metres <= NEAREST_RADIUS_M) near.push({ photo, metres });
|
if (metres <= NEAREST_RADIUS_M) near.push({ photo, metres });
|
||||||
}
|
}
|
||||||
near.sort((a, b) => a.metres - b.metres);
|
near.sort((a, b) => a.metres - b.metres);
|
||||||
for (const { photo } of near.slice(0, NEAREST_PROBES))
|
// Probed side by side (photo storage is not the API host): the
|
||||||
if (await showable(photo, { signal })) return photo.id;
|
// nearest one that answers wins.
|
||||||
|
const candidates = near.slice(0, NEAREST_PROBES);
|
||||||
|
const answers = await Promise.all(
|
||||||
|
candidates.map(({ photo }) => showable(photo, { signal })),
|
||||||
|
);
|
||||||
|
const hit = candidates.find((_, i) => answers[i]);
|
||||||
|
if (hit) return hit.photo.id;
|
||||||
if (near.length) throw new Error(ARCHIVED_MESSAGE);
|
if (near.length) throw new Error(ARCHIVED_MESSAGE);
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ export const PAGE_TIMEOUT_MS = 30_000;
|
|||||||
export const IMAGE_TIMEOUT_MS = 15_000;
|
export const IMAGE_TIMEOUT_MS = 15_000;
|
||||||
/** Whether a photo file is there (not archived): headers only. */
|
/** Whether a photo file is there (not archived): headers only. */
|
||||||
export const IMAGE_PROBE_TIMEOUT_MS = 8_000;
|
export const IMAGE_PROBE_TIMEOUT_MS = 8_000;
|
||||||
/** Nearest photos tried before giving up on archived ones. */
|
/** Nearest photos probed (at once) before giving up on archived ones; ‹ › skip this many. */
|
||||||
export const NEAREST_PROBES = 4;
|
export const NEAREST_PROBES = 6;
|
||||||
export const ARCHIVED_MESSAGE =
|
export const ARCHIVED_MESSAGE =
|
||||||
'KartaView’s photos here are archived and cannot be shown';
|
'KartaView’s photos here are archived and cannot be shown';
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user