mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 11:42:21 +00:00
Reconcile Recent Imagery cancellation with current acquisition (#881)
Preserve current injected thumbnail source and all origin changes. Keep stale-intent cancellation without reintroducing direct WVS requests; count a known-present aborted re-fetch once across repeated retention, add its regression, and use a changelog fragment. Fix docs header placement; preserve quanticsoul4772's review provenance.
This commit is contained in:
commit
cc0f6a8f15
1157 files changed
+170794
-9314
No files matched your search
@@ -8,7 +8,8 @@
|
||||
* card on every render, so a read that counted would evict the visible cards
|
||||
* first). Eviction revokes the image only; what the probe proved is kept.
|
||||
*/
|
||||
import { thumbnailOrder, wvsSnapshotUrl } from './model.js';
|
||||
import { thumbnailOrder } from './model.js';
|
||||
import { createRecentImagerySource } from './source.js';
|
||||
|
||||
const EMPTY = Object.freeze({
|
||||
status: 'unknown',
|
||||
@@ -22,6 +23,7 @@ const EMPTY = Object.freeze({
|
||||
*/
|
||||
export function createThumbnailLoader({
|
||||
fetchImpl = globalThis.fetch?.bind(globalThis),
|
||||
requestThumbnail = createRecentImagerySource({ fetchImpl }).getThumbnail,
|
||||
maxInFlight = 3,
|
||||
maxDecoded = 16,
|
||||
createObjectUrl = (blob) => URL.createObjectURL(blob),
|
||||
@@ -92,24 +94,20 @@ export function createThumbnailLoader({
|
||||
let acquisitionTime = null;
|
||||
let cancelled = false;
|
||||
try {
|
||||
const url = wvsSnapshotUrl({
|
||||
product: entry.candidate.product,
|
||||
day: entry.candidate.day,
|
||||
box: entry.box,
|
||||
width: size,
|
||||
height: size,
|
||||
const response = await requestThumbnail(entry.candidate, entry.box, {
|
||||
size,
|
||||
signal: controller.signal,
|
||||
});
|
||||
const response = await fetchImpl(url, { signal: controller.signal });
|
||||
if (controller.signal.aborted) {
|
||||
cancelled = true;
|
||||
} else if (response?.ok) {
|
||||
const present = String(
|
||||
response.headers?.get?.('Data-Present') ?? 'true',
|
||||
response.headers?.get?.('Data-Present') ?? '',
|
||||
).toLowerCase();
|
||||
acquisitionTime = response.headers?.get?.('Acquisition-Time') || null;
|
||||
if (present === 'false') {
|
||||
status = 'empty';
|
||||
} else {
|
||||
} else if (present === 'true') {
|
||||
const blob = await response.blob();
|
||||
if (controller.signal.aborted) cancelled = true;
|
||||
else {
|
||||
@@ -243,7 +241,8 @@ export function createThumbnailLoader({
|
||||
}
|
||||
for (const entry of [...entries.values()]) {
|
||||
if (!entry.loading || wanted.has(entry.key)) continue;
|
||||
entry.controller?.abort();
|
||||
if (!entry.controller || entry.controller.signal.aborted) continue;
|
||||
entry.controller.abort();
|
||||
supersededInFlight += 1;
|
||||
if (entry.status === 'unknown') entries.delete(entry.key);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user