Hero: renderer logt per ronde hoeveel foto's wachten op varianten of volledig voorbeeld
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,6 +58,8 @@ public sealed class HeroRenderSignal
|
||||
public sealed class HeroRenderService(IServiceScopeFactory scopes, HeroRenderSignal signal, IOptions<MediaOptions> media, ILogger<HeroRenderService> logger) : BackgroundService
|
||||
{
|
||||
|
||||
private bool _loggedFirstPass;
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
try
|
||||
@@ -91,6 +93,22 @@ public sealed class HeroRenderService(IServiceScopeFactory scopes, HeroRenderSig
|
||||
// An image that failed in this pass waits for the next pass (a minute later or the next wake-up): one difficult photo
|
||||
// must not hold up the others, and it is not retried straight away.
|
||||
var failedInThisPass = new HashSet<Guid>();
|
||||
try
|
||||
{
|
||||
using var scope = scopes.CreateScope();
|
||||
var (total, needRender, needPreview) = await scope.ServiceProvider.GetRequiredService<IHeroImageService>().GetRenderBacklogAsync(stoppingToken);
|
||||
if (needRender + needPreview > 0 || !_loggedFirstPass)
|
||||
{
|
||||
logger.LogInformation("Hero image renderer: {Total} images, {NeedRender} waiting for their variants, {NeedPreview} lacking the full-frame preview.", total, needRender, needPreview);
|
||||
}
|
||||
|
||||
_loggedFirstPass = true;
|
||||
}
|
||||
catch (Exception exception) when (exception is not OperationCanceledException)
|
||||
{
|
||||
logger.LogWarning(exception, "Counting the hero images that wait for the renderer failed.");
|
||||
}
|
||||
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
var skip = signal.GivenUp().Concat(failedInThisPass).ToHashSet();
|
||||
|
||||
Reference in New Issue
Block a user