Skip to content

Conversation

@martintmk
Copy link
Contributor

@martintmk martintmk commented Aug 8, 2023

Details on the issue fix or feature implementation

One reoccurring complaint about the current non-generic core was the possibility of combining incompatible reactive strategies. This PR improves the API and makes the above not possible.

This was ensured with the following changes:

  • ReactiveResilienceStrategy<T> no longer derives from ResilienceStrategy.
  • Added two new AddStrategy extensions for both CompositeStrategyBuilder and CompositeStrategyBuilder<T> that require factory returning ReactiveResilienceStrategy<T>.
  • Reimplemented all extensions for reactive strategies to use the new API

Going forward the author of custom resilience strategies can use:

  • ResilienceStrategy as a base class for non-reactive strategies
  • ReactiveResilienceStrategy<T> as a base class for reactive strategies

Contributes to #1454

Confirm the following

  • I started this PR by branching from the head of the default branch
  • I have targeted the PR to merge into the default branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

@martintmk martintmk added the v8 Issues related to the new version 8 of the Polly library. label Aug 8, 2023
@martintmk martintmk added this to the v8.0.0 milestone Aug 8, 2023
@martintmk
Copy link
Contributor Author

cc: @vany0114

In your PR you have MonkeyStrategy<T> that derives from MonkeyStrategy. With this new API that won't be possible anymore. I was thinking of making ReactiveResilienceStrategy<T> an interface but it didn't feel right.

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Merging #1462 (cabfd57) into main (b1ec863) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1462      +/-   ##
==========================================
- Coverage   83.92%   83.89%   -0.03%     
==========================================
  Files         274      276       +2     
  Lines        6506     6495      -11     
  Branches     1012     1015       +3     
==========================================
- Hits         5460     5449      -11     
  Misses        837      837              
  Partials      209      209              
Flag Coverage Δ
linux 83.89% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...CircuitBreaker/CircuitBreakerResilienceStrategy.cs 100.00% <ø> (ø)
.../Polly.Core/Fallback/FallbackResilienceStrategy.cs 100.00% <ø> (ø)
...rc/Polly.Core/Hedging/HedgingResilienceStrategy.cs 100.00% <ø> (ø)
src/Polly.Core/Retry/RetryResilienceStrategy.cs 100.00% <ø> (ø)
...ircuitBreakerCompositeStrategyBuilderExtensions.cs 100.00% <100.00%> (ø)
...c/Polly.Core/CompositeStrategyBuilderExtensions.cs 100.00% <100.00%> (ø)
...back/FallbackCompositeStrategyBuilderExtensions.cs 100.00% <100.00%> (ø)
...dging/HedgingCompositeStrategyBuilderExtensions.cs 100.00% <100.00%> (ø)
src/Polly.Core/ReactiveResilienceStrategy.cs 100.00% <100.00%> (ø)
src/Polly.Core/ResilienceStrategy.cs 100.00% <100.00%> (ø)
... and 4 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v8 Issues related to the new version 8 of the Polly library.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants