Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ private void UpdateOriginalContext()
return;
}

Debug.Assert(Tasks.Count(t => t.IsAccepted) == 1, $"There must be exactly one accepted outcome for hedging. Found {Tasks.Count(t => t.IsAccepted)}.");

if (Tasks.FirstOrDefault(static t => t.IsAccepted) is TaskExecution<T> acceptedExecution)
{
PrimaryContext!.Properties.AddOrReplaceProperties(acceptedExecution.Context.Properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,10 @@ public async Task ExecuteAsync_EnsureBackgroundWorkInSuccessfulCallNotCancelled(
// assert
_timeProvider.Advance(TimeSpan.FromDays(2));

await Assert.ThrowsAsync<TaskCanceledException>(() => backgroundTasks[0]);
await backgroundTasks[0].Invoking(async t => await t).Should().ThrowAsync<TaskCanceledException>();

// background task is still pending
Assert.False(backgroundTasks[1].IsCompleted);
backgroundTasks[1].IsCompleted.Should().BeFalse();

cts.Cancel();

Expand Down Expand Up @@ -670,7 +670,7 @@ public async Task ExecuteAsync_ZeroHedgingDelay_EnsureAllTasksSpawnedAtOnce()
var task = Create().ExecuteAsync(async c => (await Execute(c)).Result!, default);

// assert
Assert.True(allExecutionsReached.WaitOne(AssertTimeout));
allExecutionsReached.WaitOne(AssertTimeout).Should().BeTrue();
_timeProvider.Advance(LongDelay);
await task;

Expand Down Expand Up @@ -699,7 +699,7 @@ public void ExecuteAsync_InfiniteHedgingDelay_EnsureNoConcurrentExecutions()
var pending = Create().ExecuteAsync(Execute, _cts.Token);

// assert
Assert.True(allExecutions.WaitOne(AssertTimeout));
allExecutions.WaitOne(AssertTimeout).Should().BeTrue();

async ValueTask<string> Execute(CancellationToken token)
{
Expand Down