You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that Microsoft.Extensions.Http.Resilience replaces the older Microsoft.Extensions.Http.Polly extensions.
One thing I noticed is that the newer package lost the functionality to filter whether to apply timeouts or not based on the HttpRequestMessage object.
In the Microsoft.Extensions.Http.Polly package, I could do:
I don't see such option with the new APIs (which seem to directly use the Polly API). Some strategies, like Retry, do allow to access the HttpRequestMessage object, in the RetryStrategyOptions's ShouldHandle. The TimeoutStrategyOptions doesn't seem to have any configuration like that.
Am I missing something and there is some way to filter timeout strategy based on the request message, or is this functionality just not there? Will it be added?
The text was updated successfully, but these errors were encountered:
You can use TimeoutGenerator to dynamically enable/disable timeout. What you need to do is to store a flag into ResilienceContext that determines whether the timeout is disabled or not. If disabled, return Timeout.InfiniteTimespan.
You can use TimeoutGenerator to dynamically enable/disable timeout. What you need to do is to store a flag into ResilienceContext that determines whether the timeout is disabled or not. If disabled, return Timeout.InfiniteTimespan.
Could you add some pseudo-code? i'm still a bit puzzeld.
I'm using .net aspire which by default uses;
builder.Services.ConfigureHttpClientDefaults(http =>{// Turn on resilience by default http.AddStandardResilienceHandler();// Turn on service discovery by default http.UseServiceDiscovery();});
This is great, but i have some third-party services for which i definitely don't want to retry.
I need some way to be able to disable the retry for a single client.
It seems that
Microsoft.Extensions.Http.Resilience
replaces the olderMicrosoft.Extensions.Http.Polly
extensions.One thing I noticed is that the newer package lost the functionality to filter whether to apply timeouts or not based on the
HttpRequestMessage
object.In the
Microsoft.Extensions.Http.Polly
package, I could do:I don't see such option with the new APIs (which seem to directly use the Polly API). Some strategies, like Retry, do allow to access the
HttpRequestMessage
object, in theRetryStrategyOptions
'sShouldHandle
. TheTimeoutStrategyOptions
doesn't seem to have any configuration like that.Am I missing something and there is some way to filter timeout strategy based on the request message, or is this functionality just not there? Will it be added?
The text was updated successfully, but these errors were encountered: