mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-10-04 00:20:01 -04:00
fix(launcher): dead rows no longer starve FIND MODS thumbnails
_queueFindEnrichment allows two thumbnail starts per frame, but it counted a row against that allowance even when _startFindThumb ignored it. A row already resolved to "failed", or with no thumbnail at all, is ignored there, so two such rows above a card spent the allowance every frame and the card never got a download. It stayed on its MOD placeholder (no spinner) for the whole session. Skip rows that have already resolved, so only a row that actually starts a download is counted. Adds a regression test that fails without the change.
This commit is contained in:
@@ -8503,8 +8503,12 @@ function RomImporter:_queueFindEnrichment()
|
||||
if not visible then return end
|
||||
local thumbnails, stats = 0, 0
|
||||
for _, entry in ipairs(visible) do
|
||||
-- A row already resolved to "failed" (or with no thumbnail at all) must not
|
||||
-- spend this frame's allowance: _startFindThumb ignores it, so counting it
|
||||
-- let two dead rows above a card starve it of a download forever.
|
||||
if thumbnails < FIND_ENRICH_PER_FRAME
|
||||
and self:_findThumb(entry) == nil
|
||||
and not (self._findThumbs and self._findThumbs[entry.id] ~= nil)
|
||||
and not self:_findThumbPending(entry.id) then
|
||||
self:_startFindThumb(entry)
|
||||
thumbnails = thumbnails + 1
|
||||
|
||||
@@ -65,6 +65,27 @@ do
|
||||
"update schedules a bounded thumbnail and stats batch for visible rows")
|
||||
end
|
||||
|
||||
-- Rows already resolved to "failed" (or with no thumbnail) must not spend the
|
||||
-- per-frame download allowance, or two of them above a card starve it forever.
|
||||
do
|
||||
local started = {}
|
||||
local imp = setmetatable({ tab = "find", findLoaded = true,
|
||||
_findThumbs = { dead1 = false, dead2 = false },
|
||||
_findVisibleEntries = {
|
||||
{ id = "dead1", thumbnail = "https://example.invalid/1.png" },
|
||||
{ id = "dead2", thumbnail = "https://example.invalid/2.png" },
|
||||
{ id = "dead3" },
|
||||
{ id = "alive", thumbnail = "https://example.invalid/alive.png" },
|
||||
} }, RomImporter)
|
||||
imp._findThumbPending = function() return false end
|
||||
imp._findStatsCached = function() return {} end
|
||||
imp._startFindThumb = function(_, entry) started[#started + 1] = entry.id end
|
||||
imp:_queueFindEnrichment()
|
||||
eq(#started, 1, "only the row that can load starts a download")
|
||||
eq(started[1], "alive",
|
||||
"dead rows above a card do not starve it of its download")
|
||||
end
|
||||
|
||||
do
|
||||
local requests = 0
|
||||
local imp = setmetatable({}, RomImporter)
|
||||
|
||||
Reference in New Issue
Block a user