Updated scanner to infer when it has reached the end of results.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user