-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
#1875 Use Polly v8 syntax #1914
Conversation
created tests for PollyResiliencePipelineDelegatingHandler created tests for PollyQoSResiliencePipelineProvider
1875 use polly v8 syntax
…ensions` and `PollyQoSResiliencePipelineProvider` classes, as well as modifications to the `PollyQoSTests` class. In the `OcelotBuilderExtensions` class, the `GetDelegatingHandler` method is now used instead of `GetDelegatingHandlerV7` in the `AddPolly` methods. The `AddPolly` method without parameters has been simplified using a lambda expression. The `GetDelegatingHandler` method now returns a new instance of `PollyResiliencePipelineDelegatingHandler` instead of `PollyPoliciesDelegatingHandler`. In the `PollyQoSResiliencePipelineProvider` class, a comment has been added suggesting the use of `ResiliencePipelineRegistry<TKey>.GetOrAddPipeline` due to its thread-safe nature. The `MinimumThroughput` property in `circuitBreakerStrategyOptions` now uses the value from `route.QosOptions.ExceptionsAllowedBeforeBreaking`. In the `PollyQoSTests` class, the `QoSOptions` used in the test configurations have been updated. Two tests, `Should_open_circuit_breaker_then_close` and `Open_circuit_should_not_effect_different_route`, have been modified to repeat the same request as the minimum `ExceptionsAllowedBeforeBreaking` is now 2. The `GivenThereIsAPossiblyBrokenServiceRunningOn` method now delays for 2.1 seconds when the request count is 2, to ensure the circuit is open. Changes: 1. `OcelotBuilderExtensions` class updated to use `GetDelegatingHandler` method. 2. `AddPolly` methods in `OcelotBuilderExtensions` class simplified. 3. `GetDelegatingHandler` method in `OcelotBuilderExtensions` class now returns a new instance of `PollyResiliencePipelineDelegatingHandler`. 4. Comment added in `PollyQoSResiliencePipelineProvider` class suggesting the use of `ResiliencePipelineRegistry<TKey>.GetOrAddPipeline`. 5. `MinimumThroughput` property in `circuitBreakerStrategyOptions` updated to use value from `route.QosOptions.ExceptionsAllowedBeforeBreaking`. 6. `QoSOptions` in `PollyQoSTests` class updated. 7. `Should_open_circuit_breaker_then_close` and `Open_circuit_should_not_effect_different_route` tests in `PollyQoSTests` class updated. 8. `GivenThereIsAPossiblyBrokenServiceRunningOn` method in `PollyQoSTests` class updated to delay for 2.1 seconds when request count is 2.
fixed PollyQoSTests AcceptanceTests
This branch is 9 commits ahead of, 3 commits behind develop. |
…er`. This new implementation replaces the previous dictionary-based approach for managing cache for resilience pipelines.
Use `ResiliencePipelineRegistry` in `PollyQoSResiliencePipelineProvider`
I love when Raynald develops features! 😍 |
@RaynaldM I'm very sorry... But we have merge conflicts ❗ Please resolve them, and I'll review. |
Update docs according to the Polly v8 implementations and QoS design upgrade
@ggnaegi Please review and approve! I believe the PR is ready for delivery. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some minor changes, thanks!
src/Ocelot.Provider.Polly/PollyResiliencePipelineDelegatingHandler.cs
Outdated
Show resolved
Hide resolved
What I'm worrying now is increased duration of running unit tests by ~30s ! But acceptance tests cannot be moved unfortunately, and they will stay in the current testing project. |
The problem is that your design of the delegate was reused in the new delegate class by Raynald. |
@raman-m yes but I think it's quite deeply rooted in the Ocelot's design somewhere. You know, the kind of of classes that are not injected with DI. |
Great! We have the consensus! So, at least after the release I will create a TODO task to start brainstorming how to separate Polly Provider package to a separate Visual Studio solution with its own testing project. Possibly we could brainstorm how to adjust release process also. TODO
|
@raman-m, I don't think that's the problem. The problem is more related with the fact that the QoS classes don't know the polly provider, since it's provided in a project that is not referenced in ocelot base. That's why I finally used this ugly hack. |
@ggnaegi I expect your fixing code review issues and approving finally till Friday to allow Raynald to merge the PR on Friday, March 15. 🆗 ❔ |
@RaynaldM Ready for delivery! ✅
|
Closes #1875
Proposed Changes
Use Polly 8's specific syntax to define resiliencePipelines (vs. PollyPolicies)
"Polly v8 introduces the concept of resilience pipelines, a powerful tool that blends one or more resilience strategies. This new API foundation echoes the Policy Wrap of previous versions but is now integrated seamlessly into the core API. All strategies start with a pipeline."
in v7, we written
in v8, it becomes