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

Enable dynamic reloads #1254

Merged
merged 6 commits into from
Jun 7, 2023
Merged

Enable dynamic reloads #1254

merged 6 commits into from
Jun 7, 2023

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented Jun 6, 2023

The issue or feature being addressed

Closes #1241

Details on the issue fix or feature implementation

This PR adds opt-in support for reloadable pipelines. Dynamic reloads are enabled when new ConfigureBuilderContext.EnableReloads method is called.

Caller needs to provide a factory that returns a CancellationToken. When the token is cancelled the strategy is reloaded.

I have also considered using IChangeToken which is more natural to propagate changes, however, we would have to add a new dependency to Microsoft.Extensions.Primitives which seemed overkill for such small addition.

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 6, 2023
@martintmk martintmk added this to the v8.0.0 milestone Jun 6, 2023
@martintmk martintmk force-pushed the mtomka/reloadable-strategies branch from d88c71c to 7959083 Compare June 6, 2023 06:21
@codecov
Copy link

codecov bot commented Jun 6, 2023

Codecov Report

Merging #1254 (752bc14) into main (70d1bd9) will increase coverage by 0.16%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1254      +/-   ##
==========================================
+ Coverage   83.12%   83.28%   +0.16%     
==========================================
  Files         269      270       +1     
  Lines        6239     6299      +60     
  Branches      976      978       +2     
==========================================
+ Hits         5186     5246      +60     
  Misses        844      844              
  Partials      209      209              
Flag Coverage Δ
macos 83.28% <100.00%> (+0.16%) ⬆️
windows 83.28% <100.00%> (?)

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

Impacted Files Coverage Δ
src/Polly.Core/Registry/ConfigureBuilderContext.cs 100.00% <100.00%> (ø)
.../Polly.Core/Registry/ResilienceStrategyRegistry.cs 100.00% <100.00%> (ø)
...c/Polly.Core/Utils/ReloadableResilienceStrategy.cs 100.00% <100.00%> (ø)

@martintmk martintmk force-pushed the mtomka/reloadable-strategies branch from 7959083 to 62375c0 Compare June 6, 2023 08:29
@martintmk
Copy link
Contributor Author

@martincostello , anything left to address here?

@martintmk martintmk enabled auto-merge (squash) June 7, 2023 13:21
@martintmk martintmk merged commit 5cff89f into main Jun 7, 2023
@martintmk martintmk deleted the mtomka/reloadable-strategies branch June 7, 2023 14:04
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.

ResilienceStrategyRegistry should support reloadable resilience strategies
2 participants