Updated scanner to infer when it has reached the end of results.
All checks were successful
ci / build-test (push) Successful in 2m18s
ci / publish-image (push) Has been skipped

This commit is contained in:
2026-03-07 01:26:04 -05:00
parent 1e01edf1b7
commit 62c2efab01
18 changed files with 193 additions and 79 deletions

View File

@@ -7,6 +7,7 @@ using JSMR.Worker.Options;
using JSMR.Worker.UI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog.Core;
using Spectre.Console;
using System.Globalization;
@@ -45,15 +46,6 @@ public sealed class PagedScanRunner(
//log.LogInformation("Scanning page {Page} (size {Size}, locale {Locale})…", currentPage, pageSize, locale);
CliUi.PageHeader(currentPage, end);
//AnsiConsole.Status()
//.Start($"[grey]Scanning page[/] [bold]{currentPage}[/] [grey]of[/] [bold]{end}[/][grey]...[/]", ctx =>
//{
// // Simulate grinding
// Thread.Sleep(3000);
//});
//AnsiConsole.MarkupLine($"[green]✓ Scanning page[/] [bold]{currentPage}[/] [grey]of[/] [bold]{end}[/][grey]... DONE[/]");
ScanVoiceWorksRequest request = new(
PageNumber: currentPage,
PageSize: 100,
@@ -62,6 +54,12 @@ public sealed class PagedScanRunner(
ScanVoiceWorksResponse response = await handler.HandleAsync(request, cancellationToken);
if (response.EndOfResults)
{
CliUi.Information($"Reached end of results at page {currentPage}. Stopping scan.");
break;
}
int newUpcoming = response.Results.Count(x => x.UpdateStatus == VoiceWorkStatus.NewAndUpcoming);
//if (newUpcoming > 0)

View File

@@ -50,6 +50,9 @@ public static class CliUi
AnsiConsole.Write(panel);
}
public static void Information(string message) =>
AnsiConsole.MarkupLine($"[blue]🛈 {Escape(message)}[/]");
public static void Warning(string message) =>
AnsiConsole.MarkupLine($"[yellow]⚠ {Escape(message)}[/]");