Migrate the Polly resilience sample into CodeMazeGuides on .NET 10 and Polly 8 - #2135
Merged
Conversation
…d Polly 8 The sample for "Creating Resilient Microservices in .NET with Polly" lived in the standalone CodeMazeBlog/resilient-microservices-dotnet-polly repository, which predates this repo and therefore sat outside the per-article build check. It targeted .NET 5 and Polly 7.2.1. - dotnet-client-libraries/ResilienceWithPolly with StarterCode and FinishedCode side by side and an aggregate ResilienceWithPolly.sln at the folder root - every project retargeted to net10.0 and converted to minimal hosting - the gateway's v7 policies (AsyncFallbackPolicy, AsyncRetryPolicy, AsyncCircuitBreakerPolicy, AsyncPolicyWrap) rewritten as one Polly 8 ResiliencePipeline, registered with the DI container instead of held in a static field behind a null check - Thread.Sleep(5000) in the Authors failure simulation replaced with await Task.Delay, so the simulation stops demonstrating thread starvation in an article about resilience - Tests project covering the pipeline: the retry recovers one transient failure, the fallback message is returned when every attempt fails, and the circuit opens and short-circuits the dependency
The starter project has no failure simulation, so there is nothing to await. The async signature arrives in the finished project along with the Task.Delay that replaces Thread.Sleep, which is where the article introduces it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Source for Creating Resilient Microservices in .NET with Polly lived in the standalone
CodeMazeBlog/resilient-microservices-dotnet-pollyrepository, on .NET 5 and Polly 7.2.1, outside this repo's per-article build check.This migrates it in as
dotnet-client-libraries/ResilienceWithPolly, following the testing-series shape:StarterCodeandFinishedCodeside by side, plus an aggregateResilienceWithPolly.slnat the folder root so CI has a solution at the two-level path it looks for.net10.0and converted to minimal hostingAsyncFallbackPolicy,AsyncRetryPolicy,AsyncCircuitBreakerPolicy,AsyncPolicyWrap) rewritten as one Polly 8ResiliencePipeline, registered with the DI container instead of held in a static field behind a null checkThread.Sleep(5000)in the Authors failure simulation replaced withawait Task.DelayTestsproject, which the standalone repository never had: the retry recovers one transient failure, the fallback message is returned when every attempt fails, and the circuit opens and short-circuits the dependencydotnet buildanddotnet testare clean on .NET 10.0.302 — 0 warnings, 5/5 tests.