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

Expose Randomizer property and use it in retry strategy #1346

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented Jun 23, 2023

Details on the issue fix or feature implementation

This PR exposes ResilienceStrategyBuilder.Randomizer (altought hidden for now) that allows to control the randomization behavior in tests. Additionally, I have fixed the copy constructor which omitted some properties.

This change also allows (with some tricks) to calculate the aggregated delays of retry strategy.

I will use this here instead of custom code:
https://github.com/dotnet/extensions/blob/52ebc1b123613254f9dfe250515027c1332fba35/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/Internal/Validators/ValidationHelper.cs#L13

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 Jun 23, 2023
@martintmk martintmk added this to the v8.0.0 milestone Jun 23, 2023
@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Merging #1346 (ec38ca9) into main (6b38850) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1346      +/-   ##
==========================================
+ Coverage   83.58%   83.59%   +0.01%     
==========================================
  Files         270      270              
  Lines        6389     6396       +7     
  Branches     1008     1008              
==========================================
+ Hits         5340     5347       +7     
  Misses        840      840              
  Partials      209      209              
Flag Coverage Δ
linux 83.59% <100.00%> (+0.01%) ⬆️
macos 83.59% <100.00%> (+0.01%) ⬆️
windows 83.59% <100.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
src/Polly.Core/ResilienceStrategyBuilderBase.cs 100.00% <100.00%> (ø)
src/Polly.Core/ResilienceStrategyBuilderContext.cs 100.00% <100.00%> (ø)
src/Polly.Core/Retry/RetryHelper.cs 100.00% <100.00%> (ø)
src/Polly.Core/Retry/RetryResilienceStrategy.cs 100.00% <100.00%> (ø)
.../Retry/RetryResilienceStrategyBuilderExtensions.cs 100.00% <100.00%> (ø)

@martintmk martintmk enabled auto-merge (squash) June 23, 2023 06:21
@martintmk martintmk merged commit b60eea8 into main Jun 23, 2023
@martintmk martintmk deleted the mtomka/randomizer branch June 23, 2023 06:51
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