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 OutcomeGenerator #1095

Merged
merged 3 commits into from
Apr 3, 2023
Merged

Introduce OutcomeGenerator #1095

merged 3 commits into from
Apr 3, 2023

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented Apr 3, 2023

The issue or feature being addressed

Contributes to #1093 and #1094

Details on the issue fix or feature implementation

This PR introduces the base class for all generator events that generate the output value from the outcome. It also introduces the RetryDelayGenerator that is able to generate delays based on user-provided callbacks.

Usage:

new RetryStrategyOptions()
{
    RetryDelayGenerator =
        new RetryDelayGenerator()
            // generates the delay for all int-based results
            .SetGenerator<int>((outcome, args) => TimeSpan.FromSeconds(args.Attempt))
};

In the next PR I'll introduce the OutcomeEvent and the core infra for callbacks should be done.

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

codecov-commenter commented Apr 3, 2023

Codecov Report

Merging #1095 (1b35c02) into main (305650e) will increase coverage by 0.24%.
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    #1095      +/-   ##
==========================================
+ Coverage   75.72%   75.97%   +0.24%     
==========================================
  Files         178      182       +4     
  Lines        4363     4407      +44     
  Branches      808      813       +5     
==========================================
+ Hits         3304     3348      +44     
  Misses        854      854              
  Partials      205      205              
Flag Coverage Δ
linux 75.97% <100.00%> (+0.24%) ⬆️
macos 75.97% <100.00%> (+0.24%) ⬆️
windows 75.97% <100.00%> (+0.24%) ⬆️

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

Impacted Files Coverage Δ
src/Polly.Core/Retry/RetryDelayArguments.cs 100.00% <100.00%> (ø)
src/Polly.Core/Retry/RetryDelayGenerator.cs 100.00% <100.00%> (ø)
src/Polly.Core/Retry/RetryStrategyOptions.cs 100.00% <100.00%> (ø)
...rc/Polly.Core/Strategy/OutcomeGenerator.Handler.cs 100.00% <100.00%> (ø)
src/Polly.Core/Strategy/OutcomeGenerator.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 merged commit b1ffcb9 into main Apr 3, 2023
@martintmk martintmk deleted the mtomka/RetryDelayGenerator branch April 3, 2023 14:16
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