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 OutcomeEvent #1096

Merged
merged 3 commits into from
Apr 4, 2023
Merged

Introduce OutcomeEvent #1096

merged 3 commits into from
Apr 4, 2023

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented Apr 4, 2023

The issue or feature being addressed

Closes #1094 and contributes to #1093.

Details on the issue fix or feature implementation

This PR introduces the final set of event callbacks. These are void-based events that occur when something important happens. The user can register multiple callbacks for each result type.

var options = new RetryStrategyOptions();

options.OnRetry
    .Add<int>(() => Console.WriteLine("Retry occurred!"))
    .Add<int>((outcome, args) => Console.WriteLine($"Retry occurred again! Outcome: {outcome}"))
    .Add<string>(() => Console.WriteLine("Retry occurred for string-based results!"));

After this one, everything will be ready for retry strategy.

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 Apr 4, 2023
@martintmk martintmk added this to the v8.0.0 milestone Apr 4, 2023
@martintmk martintmk self-assigned this Apr 4, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 4, 2023

Codecov Report

Merging #1096 (c21d536) into main (b1ffcb9) will increase coverage by 0.22%.
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    #1096      +/-   ##
==========================================
+ Coverage   76.02%   76.25%   +0.22%     
==========================================
  Files         182      185       +3     
  Lines        4418     4459      +41     
  Branches      814      821       +7     
==========================================
+ Hits         3359     3400      +41     
  Misses        854      854              
  Partials      205      205              
Flag Coverage Δ
linux 76.25% <100.00%> (+0.22%) ⬆️
macos 76.25% <100.00%> (+0.22%) ⬆️
windows ?

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

Impacted Files Coverage Δ
src/Polly.Core/Retry/OnRetryArguments.cs 100.00% <100.00%> (ø)
src/Polly.Core/Retry/RetryStrategyOptions.cs 100.00% <100.00%> (ø)
src/Polly.Core/Strategy/OutcomeEvent.Handler.cs 100.00% <100.00%> (ø)
src/Polly.Core/Strategy/OutcomeEvent.cs 100.00% <100.00%> (ø)
src/Polly.Core/Strategy/SimpleEvent.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.

src/Polly.Core/Retry/OnRetryEvent.cs Outdated Show resolved Hide resolved
src/Polly.Core/Strategy/OutcomeEvent.cs Outdated Show resolved Hide resolved
src/Polly.Core/Strategy/SimpleEvent.cs Outdated Show resolved Hide resolved
@martintmk martintmk merged commit b24fa88 into main Apr 4, 2023
@martintmk martintmk deleted the mtomka/introduce-OutcomeEvent branch April 4, 2023 14:28
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