@@ -4,7 +4,6 @@ namespace Polly.RateLimit;
44/// <summary>
55/// A rate-limit policy that can be applied to synchronous delegates.
66/// </summary>
7- #pragma warning disable CA1062 // Validate arguments of public methods
87public class RateLimitPolicy : Policy , IRateLimitPolicy
98{
109 private readonly IRateLimiter _rateLimiter ;
@@ -14,8 +13,15 @@ internal RateLimitPolicy(IRateLimiter rateLimiter) =>
1413
1514 /// <inheritdoc/>
1615 [ DebuggerStepThrough ]
17- protected override TResult Implementation < TResult > ( Func < Context , CancellationToken , TResult > action , Context context , CancellationToken cancellationToken ) =>
18- RateLimitEngine . Implementation ( _rateLimiter , null , action , context , cancellationToken ) ;
16+ protected override TResult Implementation < TResult > ( Func < Context , CancellationToken , TResult > action , Context context , CancellationToken cancellationToken )
17+ {
18+ if ( action is null )
19+ {
20+ throw new ArgumentNullException ( nameof ( action ) ) ;
21+ }
22+
23+ return RateLimitEngine . Implementation ( _rateLimiter , null , action , context , cancellationToken ) ;
24+ }
1925}
2026
2127/// <summary>
@@ -37,6 +43,13 @@ internal RateLimitPolicy(
3743
3844 /// <inheritdoc/>
3945 [ DebuggerStepThrough ]
40- protected override TResult Implementation ( Func < Context , CancellationToken , TResult > action , Context context , CancellationToken cancellationToken ) =>
41- RateLimitEngine . Implementation ( _rateLimiter , _retryAfterFactory , action , context , cancellationToken ) ;
46+ protected override TResult Implementation ( Func < Context , CancellationToken , TResult > action , Context context , CancellationToken cancellationToken )
47+ {
48+ if ( action is null )
49+ {
50+ throw new ArgumentNullException ( nameof ( action ) ) ;
51+ }
52+
53+ return RateLimitEngine . Implementation ( _rateLimiter , _retryAfterFactory , action , context , cancellationToken ) ;
54+ }
4255}
0 commit comments