Correzione: un tempo zero per il fotogramma annulla subito
Con Budget = 0 FrameService annullava con CancelAfter, cioè con un timer: su una macchina carica il timer scattava dopo la decodifica di un video piccolo e la prova del 503 riceveva 200 (esecuzione 518 di main, lavoro immagine). Ora un tempo zero annulla subito, come già VideoFrameDecoder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f8a45eb482
commit
7d2346dfca
2 files changed
+15
-1
No files matched your search
@@ -144,7 +144,16 @@ public sealed class FrameService(IClock clock)
|
||||
ArgumentNullException.ThrowIfNull(path);
|
||||
var image = MediaConverter.ImageFormatOf(format) ?? throw new BadRequestException("I fotogrammi si salvano in JPG, PNG o WEBP senza perdita.");
|
||||
using var budget = CancellationTokenSource.CreateLinkedTokenSource(ct);
|
||||
budget.CancelAfter(Budget);
|
||||
if (Budget <= TimeSpan.Zero)
|
||||
{
|
||||
// No time at all: cancelled now, not by a timer that a busy machine may fire after a quick decode.
|
||||
budget.Cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
budget.CancelAfter(Budget);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await _one.WaitAsync(budget.Token).ConfigureAwait(false);
|
||||
|
||||
Reference in new issue
Block a user