Fixed scanning issue. Updated worker.
Some checks failed
ci / build-test (push) Has been cancelled
ci / publish-image (push) Has been cancelled

This commit is contained in:
2026-02-14 22:47:19 -05:00
parent 340c62d18b
commit a85989a337
14 changed files with 286 additions and 36 deletions

View File

@@ -1,8 +1,10 @@
using JSMR.Application.Enums;
using JSMR.Application.Scanning;
using JSMR.Infrastructure.Common.Time;
using JSMR.Worker.Options;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Globalization;
namespace JSMR.Worker.Services;
@@ -21,6 +23,10 @@ public sealed class PagedScanRunner(
int startPage = options.StartPage
?? (await checkpoints.GetLastPageAsync(options.Locale, cancellationToken)).GetValueOrDefault(0) + 1;
ITimeProvider timeProvider = serviceProvider.GetRequiredService<ITimeProvider>();
log.LogInformation("Scanning on {ScanTime}...", timeProvider.Now().DateTime.ToString(CultureInfo.CurrentCulture));
while (!cancellationToken.IsCancellationRequested)
{
int currentPage = startPage;
@@ -29,7 +35,8 @@ public sealed class PagedScanRunner(
// Iterate until empty page or end reached
for (; !cancellationToken.IsCancellationRequested && (!end.HasValue || currentPage <= end.Value); currentPage++)
{
ScanVoiceWorksHandler handler = serviceProvider.GetRequiredService<ScanVoiceWorksHandler>();
using var scope = serviceProvider.CreateScope();
ScanVoiceWorksHandler handler = scope.ServiceProvider.GetRequiredService<ScanVoiceWorksHandler>();
log.LogInformation("Scanning page {Page} (size {Size}, locale {Locale})…", currentPage, pageSize, locale);