-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Question]: Complex Pipeline Keys documentation example not working as expected #1926
Comments
You are correct in your investigation. The |
Addresses App-vNext#1926 In the Complex Pipeline Keys documenation example: https://www.pollydocs.org/advanced/dependency-injection.html#complex-pipeline-keys PipelineNameComparer.GetHashCode takes the InstanceName into account, but shouldn't. This fixes that line in the documentation.
Addresses App-vNext#1926 In the Complex Pipeline Keys documenation example: https://www.pollydocs.org/advanced/dependency-injection.html#complex-pipeline-keys PipelineNameComparer.GetHashCode takes the InstanceName into account, but shouldn't. This fixes that line in the documentation.
PR opened, lemme know if I missed anything. |
What are you wanting to achieve?
Hi,
I copied the code from from here:
https://www.pollydocs.org/advanced/dependency-injection.html#complex-pipeline-keys
Exactly into my project, but I kept getting "unable to find a resilience pipeline" exceptions.
What code or approach do you have so far?
When I looked through the code, specifically here:
Polly/src/Polly.Core/Registry/ResiliencePipelineRegistry.cs
Line 76 in 0e134b5
It seems like if there is no pipeline defined with the key specified, like in your example:
It should go ahead and look in the
_builders
dictionary and build a new pipeline, with that new key, adding it to_pipelines
, correct?But I think (?) the problem is that in your example, PipelineNameComparer.GetHashCode takes the InstanceName into account:
I think (?) paying attention to InstanceName breaks your example, because when the key search in
_builders
(above) happens, it won't find any values.Further, if I change that GetHashCode function to look like this, things work as I'd expect:
I'm not sure what I might be breaking by making that change though, or if I'm just doing something else wrong somewhere.
Thoughts?
Additional context
No response
The text was updated successfully, but these errors were encountered: