From 71db9fe40c7b280d8c15a39657c4622bc2f138cd Mon Sep 17 00:00:00 2001 From: Martin Tomka Date: Wed, 23 Aug 2023 09:36:37 +0200 Subject: [PATCH] Minor API cleanup --- src/Polly.Core/PublicAPI.Unshipped.txt | 4 ++-- src/Polly.Core/Retry/OnRetryArguments.cs | 10 +++++----- src/Polly.Testing/PublicAPI.Unshipped.txt | 2 -- src/Polly.Testing/ResiliencePipelineDescriptor.cs | 7 +------ src/Polly.Testing/ResilienceStrategyDescriptor.cs | 7 +------ test/Polly.Core.Tests/Retry/OnRetryArgumentsTests.cs | 2 +- .../Retry/RetryResilienceStrategyTests.cs | 2 +- 7 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/Polly.Core/PublicAPI.Unshipped.txt b/src/Polly.Core/PublicAPI.Unshipped.txt index 5106f7f5677..1788cb24139 100644 --- a/src/Polly.Core/PublicAPI.Unshipped.txt +++ b/src/Polly.Core/PublicAPI.Unshipped.txt @@ -269,9 +269,9 @@ Polly.ResilienceStrategyOptions.Name.set -> void Polly.ResilienceStrategyOptions.ResilienceStrategyOptions() -> void Polly.Retry.OnRetryArguments Polly.Retry.OnRetryArguments.AttemptNumber.get -> int -Polly.Retry.OnRetryArguments.ExecutionTime.get -> System.TimeSpan +Polly.Retry.OnRetryArguments.Duration.get -> System.TimeSpan Polly.Retry.OnRetryArguments.OnRetryArguments() -> void -Polly.Retry.OnRetryArguments.OnRetryArguments(int attemptNumber, System.TimeSpan retryDelay, System.TimeSpan executionTime) -> void +Polly.Retry.OnRetryArguments.OnRetryArguments(int attemptNumber, System.TimeSpan retryDelay, System.TimeSpan duration) -> void Polly.Retry.OnRetryArguments.RetryDelay.get -> System.TimeSpan Polly.Retry.RetryBackoffType Polly.Retry.RetryBackoffType.Constant = 0 -> Polly.Retry.RetryBackoffType diff --git a/src/Polly.Core/Retry/OnRetryArguments.cs b/src/Polly.Core/Retry/OnRetryArguments.cs index 2174648180b..d5775329920 100644 --- a/src/Polly.Core/Retry/OnRetryArguments.cs +++ b/src/Polly.Core/Retry/OnRetryArguments.cs @@ -15,12 +15,12 @@ public readonly struct OnRetryArguments /// /// The zero-based attempt number. /// The delay before the next retry. - /// The execution time of this attempt. - public OnRetryArguments(int attemptNumber, TimeSpan retryDelay, TimeSpan executionTime) + /// The duration of this attempt. + public OnRetryArguments(int attemptNumber, TimeSpan retryDelay, TimeSpan duration) { AttemptNumber = attemptNumber; RetryDelay = retryDelay; - ExecutionTime = executionTime; + Duration = duration; } /// @@ -34,7 +34,7 @@ public OnRetryArguments(int attemptNumber, TimeSpan retryDelay, TimeSpan executi public TimeSpan RetryDelay { get; } /// - /// Gets the execution time of this attempt. + /// Gets the duration of this attempt. /// - public TimeSpan ExecutionTime { get; } + public TimeSpan Duration { get; } } diff --git a/src/Polly.Testing/PublicAPI.Unshipped.txt b/src/Polly.Testing/PublicAPI.Unshipped.txt index a07267b1b2b..fc1938da39d 100644 --- a/src/Polly.Testing/PublicAPI.Unshipped.txt +++ b/src/Polly.Testing/PublicAPI.Unshipped.txt @@ -2,12 +2,10 @@ Polly.Testing.ResiliencePipelineDescriptor Polly.Testing.ResiliencePipelineDescriptor.FirstStrategy.get -> Polly.Testing.ResilienceStrategyDescriptor! Polly.Testing.ResiliencePipelineDescriptor.IsReloadable.get -> bool -Polly.Testing.ResiliencePipelineDescriptor.ResiliencePipelineDescriptor(System.Collections.Generic.IReadOnlyList! strategies, bool isReloadable) -> void Polly.Testing.ResiliencePipelineDescriptor.Strategies.get -> System.Collections.Generic.IReadOnlyList! Polly.Testing.ResiliencePipelineExtensions Polly.Testing.ResilienceStrategyDescriptor Polly.Testing.ResilienceStrategyDescriptor.Options.get -> Polly.ResilienceStrategyOptions? -Polly.Testing.ResilienceStrategyDescriptor.ResilienceStrategyDescriptor(Polly.ResilienceStrategyOptions? options, object! strategyInstance) -> void Polly.Testing.ResilienceStrategyDescriptor.StrategyInstance.get -> object! static Polly.Testing.ResiliencePipelineExtensions.GetPipelineDescriptor(this Polly.ResiliencePipeline! pipeline) -> Polly.Testing.ResiliencePipelineDescriptor! static Polly.Testing.ResiliencePipelineExtensions.GetPipelineDescriptor(this Polly.ResiliencePipeline! pipeline) -> Polly.Testing.ResiliencePipelineDescriptor! diff --git a/src/Polly.Testing/ResiliencePipelineDescriptor.cs b/src/Polly.Testing/ResiliencePipelineDescriptor.cs index 0bc6da42666..a914ab5eff6 100644 --- a/src/Polly.Testing/ResiliencePipelineDescriptor.cs +++ b/src/Polly.Testing/ResiliencePipelineDescriptor.cs @@ -5,12 +5,7 @@ /// public sealed class ResiliencePipelineDescriptor { - /// - /// Initializes a new instance of the class. - /// - /// The strategies the pipeline is composed of. - /// Determines whether the resilience pipeline is reloadable. - public ResiliencePipelineDescriptor(IReadOnlyList strategies, bool isReloadable) + internal ResiliencePipelineDescriptor(IReadOnlyList strategies, bool isReloadable) { Strategies = strategies; IsReloadable = isReloadable; diff --git a/src/Polly.Testing/ResilienceStrategyDescriptor.cs b/src/Polly.Testing/ResilienceStrategyDescriptor.cs index 259beb89777..30820f1a35e 100644 --- a/src/Polly.Testing/ResilienceStrategyDescriptor.cs +++ b/src/Polly.Testing/ResilienceStrategyDescriptor.cs @@ -5,12 +5,7 @@ /// public sealed class ResilienceStrategyDescriptor { - /// - /// Initializes a new instance of the class. - /// - /// The options used by the resilience strategy, if any. - /// The strategy instance. - public ResilienceStrategyDescriptor(ResilienceStrategyOptions? options, object strategyInstance) + internal ResilienceStrategyDescriptor(ResilienceStrategyOptions? options, object strategyInstance) { Options = options; StrategyInstance = strategyInstance; diff --git a/test/Polly.Core.Tests/Retry/OnRetryArgumentsTests.cs b/test/Polly.Core.Tests/Retry/OnRetryArgumentsTests.cs index 728bacdea97..7e9a107f9e1 100644 --- a/test/Polly.Core.Tests/Retry/OnRetryArgumentsTests.cs +++ b/test/Polly.Core.Tests/Retry/OnRetryArgumentsTests.cs @@ -11,6 +11,6 @@ public void Ctor_Ok() args.AttemptNumber.Should().Be(2); args.RetryDelay.Should().Be(TimeSpan.FromSeconds(3)); - args.ExecutionTime.Should().Be(TimeSpan.MaxValue); + args.Duration.Should().Be(TimeSpan.MaxValue); } } diff --git a/test/Polly.Core.Tests/Retry/RetryResilienceStrategyTests.cs b/test/Polly.Core.Tests/Retry/RetryResilienceStrategyTests.cs index 9d6a2ef1ae9..412b3e59151 100644 --- a/test/Polly.Core.Tests/Retry/RetryResilienceStrategyTests.cs +++ b/test/Polly.Core.Tests/Retry/RetryResilienceStrategyTests.cs @@ -238,7 +238,7 @@ public async Task OnRetry_EnsureExecutionTime() { _options.OnRetry = args => { - args.Arguments.ExecutionTime.Should().Be(TimeSpan.FromMinutes(1)); + args.Arguments.Duration.Should().Be(TimeSpan.FromMinutes(1)); return default; };