-
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
#1844 More open customization of Polly use #1845
Conversation
@RaynaldM Thanks for the PR! New extensions will be useful. |
4e92be2
to
9f7a724
Compare
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.
Because new extensions are public... we need XML developer's documentation.
using Polly.CircuitBreaker; | ||
using Polly.Timeout; | ||
|
||
namespace Ocelot.Provider.Polly; | ||
|
||
public static class OcelotBuilderExtensions | ||
{ | ||
private static readonly Dictionary<Type, Func<Exception, Error>> ErrorMapping = new Dictionary<Type, Func<Exception, Error>> |
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.
Why private
? Let's make it public
.
Let's rename to DefaultErrorMapping
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.
@RaynaldM Can we inject custom mapper somehow?
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.
public is useless, this default error mapping is only use in this class, and I can not surcharged because it is a static.
I can let it public if you want, but it is not a good practice to expose useless methods or properties?
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.
You can inject a custom mapper in line 42 (that what we are using currently in oiur implementation)
@ggnaegi Please review! |
But the build is still 🔴 |
@RaynaldM Is your development finished here? |
Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
9006de1
to
7189c06
Compare
Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
…ithub.com/ThreeMammals/Ocelot into 1844-more-open-customization-of-polly-use
🤕 |
If you love to press GitHub buttons then I'm letting you to finish your PR. |
My understanding this PR should be merged first before #1914 ... right? |
Exactly, it is an intermediate step |
In certain contexts, we need to be able to fully tune the way Polly is used for timeouts and circuit-breakers, but not only that.
With this in mind, I'm proposing in this PR to open up the use of AddPolly by adding :
Thanks to this, we will be able to use our own implementations of
IPollyQoSProvider<HttpResponseMessage>
,QosDelegatingHandlerDelegate
andDictionary<Type, Func<Exception, Error>>