Стримить прогресс пакетной переклассификации

CardReclassifier отдаёт IProgress-отчёты, эндпоинт публикует SSE cards_reclassified {progress:true,...} каждые 5 карточек и финальное событие; фронт показывает done/total и перечитывает доску только по финалу. Закрывает BL-RECLASS-SSE.
This commit is contained in:
Rustam Khalimov
2026-09-11 17:57:47 +03:00
parent ea21dc54c6
commit e62dbfafba
13 changed files with 209 additions and 16 deletions
@@ -0,0 +1,29 @@
using Deal.Api.Services;
using Deal.Modules.Pipeline.Application.Models;
namespace Deal.Tests.Unit.Api;
/// <summary>
/// Тесты InlineProgress — синхронный IProgress.
/// </summary>
public sealed class InlineProgressTests
{
[Fact]
public void Report_InvokesHandlerSynchronouslyWithValue()
{
int callerThread = Environment.CurrentManagedThreadId;
int handlerThread = -1;
ReclassifyProgressDto? seen = null;
var progress = new InlineProgress<ReclassifyProgressDto>(value =>
{
handlerThread = Environment.CurrentManagedThreadId;
seen = value;
});
var expected = new ReclassifyProgressDto(5, 12, 3, 2, 0, 0);
progress.Report(expected);
Assert.Equal(expected, seen);
Assert.Equal(callerThread, handlerThread);
}
}