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

Implement HedgingResilienceStrategy #1161

Merged
merged 5 commits into from
Apr 28, 2023
Merged

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented Apr 27, 2023

The issue or feature being addressed

Closes #876

Details on the issue fix or feature implementation

This PR adds all necessary infrastructure and implements Hedging Resilience Strategy.

  • When the callbacks are hedged each execution gets its own ResilienceContext and CancellationToken so the concurrent calls won't interfere with each other and can be cancelled individually.
  • Once any callback gets acceptable result the properties from cloned ResilienceContext are merged bac to the main one.
  • The primary callback still re-uses the main context.

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 force-pushed the hedging-resilience-strategy branch 7 times, most recently from 095e72c to a4d4ac4 Compare April 28, 2023 09:40
@martintmk martintmk added the v8 Issues related to the new version 8 of the Polly library. label Apr 28, 2023
@martintmk martintmk added this to the v8.0.0 milestone Apr 28, 2023
@martintmk martintmk self-assigned this Apr 28, 2023
@martintmk martintmk force-pushed the hedging-resilience-strategy branch from a4d4ac4 to 13d0266 Compare April 28, 2023 09:45
@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2023

Codecov Report

Merging #1161 (fac76b3) into main (38ae8fd) will increase coverage by 0.81%.
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    #1161      +/-   ##
==========================================
+ Coverage   82.21%   83.03%   +0.81%     
==========================================
  Files         267      272       +5     
  Lines        5898     6183     +285     
  Branches      967     1006      +39     
==========================================
+ Hits         4849     5134     +285     
  Misses        844      844              
  Partials      205      205              
Flag Coverage Δ
linux ?
macos ?
windows 83.03% <100.00%> (+0.81%) ⬆️

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

Impacted Files Coverage Δ
src/Polly.Core/Hedging/HedgingConstants.cs 100.00% <ø> (ø)
...c/Polly.Core/Hedging/Controller/ContextSnapshot.cs 100.00% <100.00%> (ø)
...Polly.Core/Hedging/Controller/HedgingController.cs 100.00% <100.00%> (ø)
...Core/Hedging/Controller/HedgingExecutionContext.cs 100.00% <100.00%> (ø)
src/Polly.Core/Hedging/Controller/TaskExecution.cs 100.00% <100.00%> (ø)
...Hedging/HedgingActionGeneratorArguments.TResult.cs 100.00% <100.00%> (ø)
...ly.Core/Hedging/HedgingActionGeneratorArguments.cs 100.00% <100.00%> (ø)
src/Polly.Core/Hedging/HedgingHandler.Handler.cs 100.00% <100.00%> (ø)
src/Polly.Core/Hedging/HedgingHandler.cs 100.00% <100.00%> (ø)
...rc/Polly.Core/Hedging/HedgingResilienceStrategy.cs 100.00% <100.00%> (ø)
... and 6 more

@martintmk martintmk force-pushed the hedging-resilience-strategy branch from 9ead9c2 to ed306c4 Compare April 28, 2023 11:46
@martintmk martintmk marked this pull request as ready for review April 28, 2023 13:25
@martintmk martintmk force-pushed the hedging-resilience-strategy branch 3 times, most recently from b65ea4b to 8bf2a8a Compare April 28, 2023 13:44
@martintmk martintmk force-pushed the hedging-resilience-strategy branch from 8bf2a8a to 60f4113 Compare April 28, 2023 13:49
@martintmk martintmk enabled auto-merge (squash) April 28, 2023 14:44
@martintmk martintmk merged commit 2d47e4f into main Apr 28, 2023
@martintmk martintmk deleted the hedging-resilience-strategy branch April 28, 2023 15:12
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.

Introduce Hedging Strategy
3 participants