Стримить прогресс пакетной переклассификации
CardReclassifier отдаёт IProgress-отчёты, эндпоинт публикует SSE cards_reclassified {progress:true,...} каждые 5 карточек и финальное событие; фронт показывает done/total и перечитывает доску только по финалу. Закрывает BL-RECLASS-SSE.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user