Skip to content
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 base class for predicates #1094

Merged
merged 3 commits into from
Apr 3, 2023
Merged

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented Mar 31, 2023

The issue or feature being addressed

#1067

Details on the issue fix or feature implementation

Contributes to #1093

Usage:

Derive from the base class:

public sealed class ShouldRetryPredicate : Predicate<ShouldRetryArguments, ShouldRetryPredicate>
{
}

And call the methods on ShouldRetryPredicate:

predicate
   .AddException<InvalidOperationException>()
   .AddResult(1))
   .AddResult(result => IsValid(result));

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 marked this pull request as ready for review March 31, 2023 14:33
@codecov-commenter
Copy link

codecov-commenter commented Mar 31, 2023

Codecov Report

Merging #1094 (97bcd22) into main (2f84eab) will increase coverage by 0.69%.
The diff coverage is 100.00%.

📣 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    #1094      +/-   ##
==========================================
+ Coverage   75.04%   75.73%   +0.69%     
==========================================
  Files         173      178       +5     
  Lines        4243     4365     +122     
  Branches      790      808      +18     
==========================================
+ Hits         3184     3306     +122     
  Misses        854      854              
  Partials      205      205              
Flag Coverage Δ
linux 75.73% <100.00%> (+0.69%) ⬆️
macos 75.73% <100.00%> (?)
windows 75.73% <100.00%> (+0.69%) ⬆️

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

Impacted Files Coverage Δ
src/Polly.Core/Retry/RetryStrategyOptions.cs 100.00% <100.00%> (ø)
src/Polly.Core/Retry/ShouldRetryArguments.cs 100.00% <100.00%> (ø)
src/Polly.Core/Strategy/Outcome.cs 100.00% <100.00%> (ø)
...rc/Polly.Core/Strategy/OutcomePredicate.Handler.cs 100.00% <100.00%> (ø)
src/Polly.Core/Strategy/OutcomePredicate.cs 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@martintmk martintmk force-pushed the mtomka/ShouldRetryPredicate branch from 983cee0 to 97bcd22 Compare April 1, 2023 12:21
@martintmk martintmk self-assigned this Apr 3, 2023
@martintmk martintmk added the v8 Issues related to the new version 8 of the Polly library. label Apr 3, 2023
@martintmk martintmk added this to the v8.0.0 milestone Apr 3, 2023
@martintmk martintmk merged commit 305650e into main Apr 3, 2023
@martintmk martintmk deleted the mtomka/ShouldRetryPredicate branch April 3, 2023 12:08
This was referenced Apr 3, 2023
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.

3 participants