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 RetryStrategyOptions.MaxDelay property #1620

Merged
merged 2 commits into from
Sep 22, 2023
Merged

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented Sep 22, 2023

Details on the issue fix or feature implementation

Closes #1605

Usage:

new ResiliencePipelineBuilder().AddRetry(new RetryStrategyOptions
{
  MaxRetryAttempts = int.MaxValue,
  BackoffType = DelayBackoffType.Exponential,
  UseJitter = true,
  MaxDelay = TimeSpan.FromHours(1), // max delay is one hour
});

Additional changes:

  • Changed how jitter is applied. It is not only additive now, but it can also decrease the value.

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

codecov bot commented Sep 22, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02% 🎉

Comparison is base (a511f53) 84.63% compared to head (17a20e5) 84.65%.
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1620      +/-   ##
==========================================
+ Coverage   84.63%   84.65%   +0.02%     
==========================================
  Files         306      306              
  Lines        6820     6829       +9     
  Branches     1044     1045       +1     
==========================================
+ Hits         5772     5781       +9     
  Misses        839      839              
  Partials      209      209              
Flag Coverage Δ
linux ?
macos 84.65% <100.00%> (+0.02%) ⬆️
windows 84.65% <100.00%> (+0.02%) ⬆️

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

Files Changed Coverage Δ
src/Polly.Core/Retry/RetryHelper.cs 100.00% <100.00%> (ø)
src/Polly.Core/Retry/RetryResilienceStrategy.cs 100.00% <100.00%> (ø)
...c/Polly.Core/Retry/RetryStrategyOptions.TResult.cs 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martintmk martintmk enabled auto-merge (squash) September 22, 2023 13:05
@martintmk martintmk merged commit 7e894e3 into main Sep 22, 2023
14 checks passed
@martintmk martintmk deleted the mtomka/max-delay branch September 22, 2023 13:29
@martincostello
Copy link
Member

Did this addition get documented in a subsequent PR?

@martintmk
Copy link
Contributor Author

Did this addition get documented in a subsequent PR?

#1631

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.

Limiting max retry delay when using standard backoff types
3 participants