fix(archive): the orphans fix queues the deep analysis a scan would

A desktop scan queues a background deep analysis of the sequences whose
frames it changed when Settings > Analysis > After a scan is on; photos the
Archive screen's orphans fix indexed got only the light analysis, which then
dropped the deep status. ArchiveService.ReconcileAsync takes that setting
and queues the deep analysis too, at background priority. A follow-up is
left out when a queued job of its kind already covers the sequence, whatever
else that job targets, as the scan's follow-ups check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 23:58:19 +00:00
1 parent 7abab486e4
commit b76b745d7d
4 files changed
+57 -11

No files matched your search

+11 -5
View File
@@ -288,15 +288,18 @@ public sealed class ArchiveService : IJobHandlerProvider
/// <summary>
/// Orphans fix: index the unlisted photos of a sequence and flag its missing files. Photos added, gone or back clear
/// what covered the frames, as a scan's reconcile does (<see cref="ArchiveIndexer.ReconcileAsync"/>), and what a scan's
/// follow-ups would make again is queued on <paramref name="followUps"/> (null: nothing): the light analysis and, on a
/// server (<see cref="ArchiveServiceOptions.ImagesAfterScan"/>), the thumbnails and proxies. A kind the engine does
/// not run, or already queued for the sequence, is left out.
/// follow-ups would make again is queued on <paramref name="followUps"/> (null: nothing): the light analysis, a
/// background deep analysis when <paramref name="deepAnalysis"/> asks (as <see cref="ScanParameters.DeepAnalysis"/>
/// does for a scan) and, on a server (<see cref="ArchiveServiceOptions.ImagesAfterScan"/>), the thumbnails and proxies.
/// A kind the engine does not run, or one a queued job of that kind already covers for the sequence, is left out.
/// </summary>
public async Task ReconcileAsync(Guid sequenceId, JobEngine? followUps, CancellationToken cancellationToken = default)
public async Task ReconcileAsync(Guid sequenceId, JobEngine? followUps, bool deepAnalysis, CancellationToken cancellationToken = default)
{
var (archive, sequence) = await LoadSequenceAsync(sequenceId, cancellationToken).ConfigureAwait(false);
if (!await Indexer.ReconcileAsync(archive, sequence, cancellationToken).ConfigureAwait(false) || followUps is null) return;
List<ArchiveJobRequest> requests = [ProcessingJobs.LightAnalysis([sequenceId], sequence.DisplayTitle)];
// BRIEF §10.2: background, low priority.
if (deepAnalysis) requests.Add(ProcessingJobs.DeepAnalysis([sequenceId], sequence.DisplayTitle) with { Priority = JobPriority.Background });
if (_writer.Options.ImagesAfterScan)
{
requests.Add(ArchiveJobs.Thumbnails([sequenceId], sequence.DisplayTitle));
@@ -305,7 +308,10 @@ public sealed class ArchiveService : IJobHandlerProvider
}
foreach (var request in requests)
{
if (!followUps.Runs(request.Kind) || await _db.Jobs.IsQueuedAsync(request.Kind, sequenceId, cancellationToken).ConfigureAwait(false)) continue;
if (!followUps.Runs(request.Kind)) continue;
// A queued job runs after the fix, on the frames as they are then, whatever else it targets (a scan's follow-ups).
var queued = await _db.Jobs.ListQueuedAsync(request.Kind, 1000, cancellationToken).ConfigureAwait(false);
if (queued.Any(j => j.TargetIds.Contains(sequenceId))) continue;
await followUps.EnqueueAsync(request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
}