修复错误

This commit is contained in:
zhengxuan.zhang
2026-05-18 15:56:48 +08:00
parent dcc15f62d1
commit c5ec105890
@@ -533,8 +533,13 @@ internal sealed class SynchronousProgress<T> : IProgress<T>
.Returns(Task.CompletedTask);
using var cts = new CancellationTokenSource();
// Cancel after 50ms — well before the 5000ms delay completes
cts.CancelAfter(50);
// Cancel after BeginRunAsync is called — ensures execution has started
// but cancellation fires well before the 5000ms WaitDelay completes
mockStore.Setup(s => s.BeginRunAsync(
It.IsAny<InspectionRunRecord>(),
It.IsAny<InspectionAssetWriteRequest>()))
.Callback<InspectionRunRecord, InspectionAssetWriteRequest>((_, __) => cts.CancelAfter(50))
.Returns(Task.CompletedTask);
await service.ExecuteAsync(program, null, cts.Token);