How to avoid AddHttpClient shared polly policies #2485
Replies: 1 comment 9 replies
-
I don't fully understand your question, but it sounds like you want per-client rate limits. If that's what you want, then you need to configure your rate limits to work that way using some client-specific information to shard the rate limits so they aren't global to all calls to your web service. If you want to do that, you should use the Polly.Core rate limiting functionality coupled with client-rate limits using the built-in .NET rate limiting functionality. The code snippets above use our "v7" Polly API that uses the older ASP.NET Core integration with HttpClientFactory. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a WebService that is being used in multiple VMs via dependency injection, the WebService is configured with some Polly-provided policies, but I've found that these policies share state, which means that if vm1 is using the WebService for exactly ~2 requests per second (which just don't trigger a rate-limit), then the The other vm's can't make requests because if they do, then a rate limit exception is thrown.
How can this be resolved? The expected behavior should be that the WebServices that different vm's depend on are isolated.
Translated with DeepL.com (free version)
Beta Was this translation helpful? Give feedback.
All reactions