refactor(imagery): drop unused cancellation counters and impossible-case guards

This commit is contained in:
German Khokhlov committed 2026-11-18 16:41:04 +04:00
1 parent a0db300d54
commit bd84fab552
3 files changed
+8 -33

No files matched your search

+5 -21
View File
@@ -37,8 +37,6 @@ export function createThumbnailLoader({
const queue = [];
let inFlight = 0;
let touchCounter = 0;
let supersededQueued = 0;
let supersededInFlight = 0;
let destroyed = false;
function notify(key) {
@@ -225,14 +223,10 @@ export function createThumbnailLoader({
candidates.length,
extra,
);
const keys = [];
order.forEach((index, priority) => {
const candidate = candidates[index];
if (!candidate?.key) return;
keys.push(candidate.key);
this.request(candidate, box, priority);
return order.map((index, priority) => {
this.request(candidates[index], box, priority);
return candidates[index].key;
});
return keys;
},
/**
@@ -242,19 +236,16 @@ export function createThumbnailLoader({
* @param {Iterable<string>} keys
*/
retain(keys) {
const wanted = new Set(keys || []);
const wanted = new Set(keys);
for (let index = queue.length - 1; index >= 0; index -= 1) {
const entry = queue[index];
if (wanted.has(entry.key)) continue;
queue.splice(index, 1);
supersededQueued += 1;
if (entry.status === 'unknown') entries.delete(entry.key);
}
for (const entry of [...entries.values()]) {
if (!entry.loading || wanted.has(entry.key)) continue;
if (!entry.controller || entry.controller.signal.aborted) continue;
entry.controller.abort();
supersededInFlight += 1;
entry.controller?.abort();
if (entry.status === 'unknown') entries.delete(entry.key);
}
},
@@ -301,13 +292,6 @@ export function createThumbnailLoader({
return () => listeners.delete(listener);
},
refinementStats() {
return {
supersededQueued,
supersededInFlight,
};
},
stats() {
return {
inFlight,