-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce RetryResilienceStrategy #1101
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #1101 +/- ##
==========================================
+ Coverage 76.35% 76.96% +0.60%
==========================================
Files 185 191 +6
Lines 4479 4597 +118
Branches 821 838 +17
==========================================
+ Hits 3420 3538 +118
Misses 854 854
Partials 205 205
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
src/Polly.Core.Tests/Retry/RetryResilienceStrategyBuilderExtensionsTests.cs
Outdated
Show resolved
Hide resolved
RetryBackoffType.Linear => (attempt + 1) * baseDelay, | ||
RetryBackoffType.Exponential => Math.Pow(ExponentialFactor, attempt) * baseDelay, | ||
#endif | ||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, "The retry backoff type is not supported.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I recommend switching to use helpers for throwing exceptions in the code base. Helpers reduce code size and improve i-cache efficiency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it here, but it doesn't work because switch expression expects the TimeSpan result type.
error CS0029: Cannot implicitly convert type 'void' to 'System.TimeSpan'
I'll leave it as it is for now.
The issue or feature being addressed
Contributes to #1093
Details on the issue fix or feature implementation
This PR adds the retry resilience strategy to V8. Only core functionality added for now, to be expanded later.
Some missing pieces:
RetryBackoffType.ExponentialWithJitter
RetryResilienceStrategyBuilderExtensions
(custom retries, OnRetry callbacks)Usage:
Confirm the following