-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed as not planned
Labels
affected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futureFeatures related to the built in components we ship or could ship in the futureinvestigateseverity-majorThis label is used by an internal toolThis label is used by an internal tool
Milestone
Description
Describe the bug
Using a Polly Policy in blazor on httpclient does not execute policy on a transient failure.
To Reproduce
Steps to reproduce the behavior:
Using the code below:
using System;
using System.Collections.Generic;
using System.Net.Http;
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
using Polly;
namespace Web.Client
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// custom wasm request handler to add a bearer token to each internally matching request
services.AddSingleton(x => new HttpClient(new TokenWebAssemblyMessageHandler(x.GetService<ITokenService>())));
// add polly wait and retry policy
services.AddHttpClient<IMicroServiceClient, SomeMicroserviceClient>()
.AddTransientHttpErrorPolicy(builder => builder.WaitAndRetryAsync(new[]
{
TimeSpan.FromMilliseconds(300),
TimeSpan.FromMilliseconds(600),
TimeSpan.FromMilliseconds(900),
TimeSpan.FromMilliseconds(1200)
}));
services.AddSingleton<AppState>();
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}Expected behavior
When the httpclient makes a failed call, i.e. response in the 5xx and 4xx ranges, should retry the request per the orders of policy.
mattgenious
Metadata
Metadata
Assignees
Labels
affected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futureFeatures related to the built in components we ship or could ship in the futureinvestigateseverity-majorThis label is used by an internal toolThis label is used by an internal tool