diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 6d0fa3bb11f..9c8066d48dc 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -21,4 +21,4 @@ ] } } -} \ No newline at end of file +} diff --git a/Directory.Packages.props b/Directory.Packages.props index 55a6bc4908c..5b3afaff195 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + @@ -33,14 +33,14 @@ - + - - + + diff --git a/src/Polly.Core/Utils/Pipeline/ReloadableComponent.cs b/src/Polly.Core/Utils/Pipeline/ReloadableComponent.cs index 82b3caac674..ca745fce1bf 100644 --- a/src/Polly.Core/Utils/Pipeline/ReloadableComponent.cs +++ b/src/Polly.Core/Utils/Pipeline/ReloadableComponent.cs @@ -52,7 +52,9 @@ private void TryRegisterOnReload() return; } +#pragma warning disable S3878 // Arrays should not be created for params parameters _tokenSource = CancellationTokenSource.CreateLinkedTokenSource([.. _reloadTokens]); +#pragma warning restore S3878 // Arrays should not be created for params parameters _registration = _tokenSource.Token.Register(() => { var context = ResilienceContextPool.Shared.Get().Initialize(isSynchronous: true); @@ -93,20 +95,20 @@ private async Task DisposeDiscardedComponentSafeAsync(PipelineComponent componen ResilienceContextPool.Shared.Return(context); } -#pragma warning disable S2952 // Classes should "Dispose" of members from the classes' own "Dispose" methods private void DisposeRegistration() { _registration.Dispose(); _tokenSource.Dispose(); } -#pragma warning restore S2952 // Classes should "Dispose" of members from the classes' own "Dispose" methods internal record ReloadFailedArguments(Exception Exception); internal record DisposedFailedArguments(Exception Exception); #pragma warning disable S2094 // Classes should not be empty +#pragma warning disable S3253 // Constructor and destructor declarations should not be redundant internal record OnReloadArguments(); +#pragma warning restore S3253 // Constructor and destructor declarations should not be redundant #pragma warning restore S2094 // Classes should not be empty internal record Entry(PipelineComponent Component, List ReloadTokens, ResilienceStrategyTelemetry Telemetry); diff --git a/src/Polly.RateLimiting/RateLimiterResiliencePipelineBuilderExtensions.cs b/src/Polly.RateLimiting/RateLimiterResiliencePipelineBuilderExtensions.cs index 994b81d9192..1006684bb10 100644 --- a/src/Polly.RateLimiting/RateLimiterResiliencePipelineBuilderExtensions.cs +++ b/src/Polly.RateLimiting/RateLimiterResiliencePipelineBuilderExtensions.cs @@ -79,7 +79,7 @@ public static TBuilder AddRateLimiter( return builder.AddRateLimiter(new RateLimiterStrategyOptions { - RateLimiter = args => limiter.AcquireAsync(1, args.Context.CancellationToken), + RateLimiter = args => limiter.AcquireAsync(cancellationToken: args.Context.CancellationToken), }); } @@ -115,7 +115,7 @@ public static TBuilder AddRateLimiter( { var defaultLimiter = new ConcurrencyLimiter(options.DefaultRateLimiterOptions); wrapper = new DisposeWrapper(defaultLimiter); - limiter = args => defaultLimiter.AcquireAsync(1, args.Context.CancellationToken); + limiter = args => defaultLimiter.AcquireAsync(cancellationToken: args.Context.CancellationToken); } return new RateLimiterResilienceStrategy(