video: coverage-card click re-queues failed matches (match music manager)

The video worker manager's coverage cards only switched the view — they never
re-queued failed items, so not_found/error items sat in the retry cooldown and
the worker reported 'all matched' / idle while failures piled up. Clicking a
Movies/Shows coverage card now pins that group AND resets its failed matches
(not_found/error -> pending) so the worker sweeps them, mirroring the music
worker manager. (Episodes are a sync cascade, not a match queue, so unchanged.)
This commit is contained in:
BoulderBadgeDad 2026-06-15 14:27:25 -07:00
parent df09111831
commit b7ae32220b

View file

@ -281,7 +281,33 @@
function switchKind(kind) {
state.kind = kind; state.page = 0;
renderCards();
loadUnmatched().then(function () { renderControls(); renderList(); });
// Like the music worker manager: clicking a coverage group also "pins" it
// and RE-QUEUES its previously-failed items (not_found/error -> pending) so
// the worker sweeps ALL unmatched, not just never-tried ones — otherwise
// failed items sit forever (in the retry cooldown) and the worker reports
// "all matched". (Episodes are a sync cascade, not a match queue.)
if (kind === 'movie' || kind === 'show') {
setPriority(kind);
requeueFailed(kind);
} else {
loadUnmatched().then(function () { renderControls(); renderList(); });
}
}
function requeueFailed(kind) {
fetch('/api/video/enrichment/' + state.selected + '/retry', {
method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
body: JSON.stringify({ kind: kind, scope: 'failed' }),
}).then(function (r) { return r.ok ? r.json() : null; })
.then(function (d) {
var n = (d && d.reset) || 0;
if (n && typeof showToast === 'function') {
showToast('Re-queued ' + n + ' previously-failed ' +
(KIND_LABEL[kind] || kind).toLowerCase(), 'success');
}
return Promise.all([loadBreakdown(state.selected), loadUnmatched()]);
})
.then(function () { renderCards(); renderControls(); renderList(); })
.catch(function () { loadUnmatched().then(function () { renderControls(); renderList(); }); });
}
function togglePause() {
var s = state.statuses[state.selected] || {};