fix(server): keep convert dry runs like Reorganize's, say what a new sequence lacks
The convert endpoint planned the whole selection inside the HTTP request, again for every mode, quality keystroke and confirmation, with no limit: behind a proxy an all-sequence conversion could never get past its dry run or its apply. - ReorganizePlanCache becomes PlanCache, shared by Reorganize and Convert: one plan per key made apart from the request, two at once across both kinds, eight kept, 15-minute timeout, 5-minute lifetime, 503 plan_dropped. Keys are typed records (ReorganizePlanKey, ConvertPlanKey) that also say which exceptions are refusals. - A conversion plan is keyed by archive, a convert stamp of the index (SequenceRepository.GetConvertStampAsync: the Reorganize stamp plus, per planned sequence, the photos' count, sizes, formats, pixel sizes and missing, corrupt, preview-only and undecodable flags), the sequences and the target with the quality that counts. Not the mode: the request's mode and options are set on the kept plan, and the free space is measured again at every request through the engine. A plan made while the volume was away is not kept (503 archive_offline). - New sequence holds the converted copies alone: the dry run says the skipped photos are not copied into it (Archive.Convert.NotCopied.*, Server.Convert.OnPcNew), the panel's totals, column and confirmation give the count, and so does the desktop's summary. - Panel: the preview is asked in Replace's neutral words; a dry run cut off by a proxy is asked again while the totals show how long it takes, plan_dropped is retried once; an apply the server let go plans again, a changed one shows Admin.Convert.PlanChanged, and one with no answer is not resent (its job may be queued). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f0b1e379ce7c08b6d3459ab25ca6214c8f366f6c)
This commit is contained in:
1 parent
d0bbd77c92
commit
8174852a2c
22 files changed
+927
-342
No files matched your search
@@ -124,6 +124,11 @@ public sealed class ConvertDialogViewModel : ArchiveDialogViewModel
|
||||
{
|
||||
if (value is { } mode && !Enum.IsDefined(mode)) return;
|
||||
if (!Set(ref _mode, value)) return;
|
||||
// The rows say what becomes of the photos skipped in the mode's words: not copied into a new sequence.
|
||||
lock (_gate)
|
||||
{
|
||||
if (_run.Plan is { } plan) _run = _run with { Rows = RowsOf(plan) };
|
||||
}
|
||||
OnPropertyChanged(nameof(IsReplace));
|
||||
OnPropertyChanged(nameof(IsNewSequence));
|
||||
OnPlanChanged();
|
||||
@@ -218,7 +223,7 @@ public sealed class ConvertDialogViewModel : ArchiveDialogViewModel
|
||||
{
|
||||
_planning?.Cancel();
|
||||
_planning = null;
|
||||
_run = new DryRun(Current(), plan, ConvertPlans.Rows(plan));
|
||||
_run = new DryRun(Current(), plan, RowsOf(plan));
|
||||
}
|
||||
BusyText = null;
|
||||
ClearError();
|
||||
@@ -238,11 +243,14 @@ public sealed class ConvertDialogViewModel : ArchiveDialogViewModel
|
||||
Quality.Refresh();
|
||||
lock (_gate)
|
||||
{
|
||||
if (_run.Plan is { } plan) _run = _run with { Rows = ConvertPlans.Rows(plan) };
|
||||
if (_run.Plan is { } plan) _run = _run with { Rows = RowsOf(plan) };
|
||||
}
|
||||
base.OnLanguageChanged();
|
||||
}
|
||||
|
||||
/// <summary>The rows of <paramref name="plan"/> in the mode chosen (as planned while none is: the skipped photos stay as they are).</summary>
|
||||
private IReadOnlyList<ConvertRow> RowsOf(ConvertPlan plan) => ConvertPlans.Rows(_mode is { } mode ? plan with { Mode = mode } : plan);
|
||||
|
||||
/// <summary>Typing makes the dry run on screen old at once (Apply waits) and plans again once the typing pauses.</summary>
|
||||
private void OnTyped()
|
||||
{
|
||||
@@ -290,7 +298,8 @@ public sealed class ConvertDialogViewModel : ArchiveDialogViewModel
|
||||
try
|
||||
{
|
||||
var plan = await Task.Run(() => _archives.PlanConvertAsync(_archive.Id, set, options!, mode, cts.Token), cts.Token);
|
||||
result = new DryRun(options, plan, ConvertPlans.Rows(plan));
|
||||
// In the mode chosen now: it may have been chosen while the plan was made.
|
||||
result = new DryRun(options, plan, RowsOf(plan));
|
||||
}
|
||||
catch (OperationCanceledException) when (cts.IsCancellationRequested)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user