Skip to content

Commit

Permalink
Add comment to clarify
Browse files Browse the repository at this point in the history
Add comment as requested in peer review.
  • Loading branch information
martincostello committed Jun 27, 2023
1 parent 8dc6e8c commit 190f096
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Polly.Core/Utils/TimeProviderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public static Task DelayAsync(this TimeProvider timeProvider, TimeSpan delay, Re

if (context.IsSynchronous)
{
#pragma warning disable CA1849 // For synchronous scenarios we want to return completed task
#pragma warning disable CA1849
// For synchronous scenarios we want to return a completed task. We avoid
// the use of Thread.Sleep() here because it is not cancellable and to
// simplify the code. Sync-over-async is not a concern here because it
// only applies in the case of a reilience event and not on the hot path.
timeProvider.Delay(delay, context.CancellationToken).GetAwaiter().GetResult();
#pragma warning restore CA1849

Expand Down

0 comments on commit 190f096

Please sign in to comment.