File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed
src/Polly.Core/Hedging/Controller Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -202,21 +202,9 @@ private void UpdateOriginalContext()
202
202
return ;
203
203
}
204
204
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 ) } .") ;
207
206
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 )
220
208
{
221
209
originalContext . Properties . Replace ( acceptedExecution . Properties ) ;
222
210
You can’t perform that action at this time.
0 commit comments