Skip to content

Commit 8383cd7

Browse files
committed
Kill mutant
1 parent 5d16fe2 commit 8383cd7

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/Polly.Core/Hedging/Controller/HedgingExecutionContext.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,9 @@ private void UpdateOriginalContext()
202202
return;
203203
}
204204

205-
int accepted = 0;
206-
TaskExecution<T>? acceptedExecution = null;
205+
Debug.Assert(Tasks.Count(t => t.IsAccepted) == 1, $"There must be exactly one accepted outcome for hedging. Found {Tasks.Count(t => t.IsAccepted)}.");
207206

208-
foreach (var task in Tasks)
209-
{
210-
if (task.IsAccepted)
211-
{
212-
accepted++;
213-
acceptedExecution = task;
214-
}
215-
}
216-
217-
Debug.Assert(accepted == 1, $"There must be exactly one accepted outcome for hedging. Found {accepted}.");
218-
219-
if (acceptedExecution is not null)
207+
if (Tasks.FirstOrDefault(static t => t.IsAccepted) is TaskExecution<T> acceptedExecution)
220208
{
221209
originalContext.Properties.Replace(acceptedExecution.Properties);
222210

0 commit comments

Comments
 (0)