E5: il cancello dei lavori lunghi cede il passo ai lavori di Alberto

La copia automatica prenderà il cancello con un permesso che cede
(TryEnterYielding): esclude gli altri lavori come ogni permesso, ma
importazione, ricostruzione e zip di fotogrammi lo prendono con
EnterAsync prima del proprio lucchetto e prima di registrare qualcosa.
Chi entra diventa subito titolare, la copia automatica riceve l'ordine
di fermarsi e si aspetta che lasci, in tempo reale, al più 15 secondi;
oltre, il lavoro è rifiutato con il messaggio della copia e la copia
resta titolare finché non lascia. «Cerca i video fermi» la ferma con
CancelYielding. BusyFirm decide i rifiuti anticipati, Busy resta per
chi aspetta (conversione della libreria, video fermi).

Una ricostruzione finita risveglia la copia automatica, e la sonda del
controllo delle cartelle è riservata come i file temporanei, così la
pulizia dei resti di un altro lavoro non la toglie mentre è in uso.

Risposta 49 di Alberto: la copia automatica cede sempre il passo.
Una riga in decisioni.md. ExportService resta alla tappa successiva.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-04 13:39:15 +01:00
1 parent f2568b5d88
commit cfd0ef88d7
11 files changed
+757 -58

No files matched your search

@@ -151,7 +151,8 @@ public sealed record StillVideoProgress(
/// <item><see cref="StartAsync"/>, «Cerca i video fermi» from a selection (answer 41): a job in memory, one video at a
/// time, never during an engine session and never while an import, a copy, a rebuild or a zip of frames holds the
/// <see cref="LongWorkGate"/> (it takes no lease, so it never blocks them: a video being analysed when one starts is
/// given up and analysed again after). Each video within <see cref="StillVideoEnvironment.JobBudget"/>, inside the
/// given up and analysed again after). An automatic copy is the exception: a start asks it to stop
/// (<see cref="LongWorkGate.CancelYielding"/>, tappa E5), and the job waits only until it has let go. Each video within <see cref="StillVideoEnvironment.JobBudget"/>, inside the
/// <see cref="ConversionThrottle"/>; past it «Non analizzabile» (TooSlow) is stored. Videos with a result of the current
/// algorithm are skipped, but for those whose analysis took too long (a start tries them again, once): so a job ended by
/// «Interrompi» or by closing Febe is not resumed by itself: started again, it goes on where it was.</item>
@@ -360,6 +361,7 @@ public sealed class StillVideoService : IDisposable
{
ObjectDisposedException.ThrowIf(_disposed, this);
var (items, _, _, _) = await CollectAsync(selection, ct).ConfigureAwait(false);
StillVideoProgress started;
lock (_lock)
{
if (!_running || _jobStop.IsCancellationRequested)
@@ -393,8 +395,17 @@ public sealed class StillVideoService : IDisposable
_loop = Task.Run(LoopAsync);
}
return Snapshot() with { Added = added };
started = Snapshot() with { Added = added };
}
if (started.Running)
{
// Alberto's search comes before an automatic copy (§16 answer 49): it is asked to stop, outside the lock (the
// token's callbacks run synchronously), and the job waits for the gate as for any long work.
_env.Gate?.CancelYielding();
}
return started;
}
/// <summary>«Interrompi»: the queue empties, the video being analysed is given up and nothing is stored for it.</summary>