public static void AddHttpClientWithPolicyHandler(this IServiceCollection services, MazeApiSettings mazeApiSettings) { services .AddHttpClient <ITvMazeHttpClient, TvMazeHttpClient>(client => { client.BaseAddress = new Uri(mazeApiSettings.BaseUrl); }) .AddPolicyHandler(PolicyHandler.WaitAndRetry()) .AddPolicyHandler(PolicyHandler.Timeout()); }
public static IServiceCollection AddHealthChecks(this IServiceCollection services, Action <IHealthCheckBuilder> configureHealthCheckBuilder) { return(AddHealthChecks(services, configureHealthCheckBuilder, new [] { PolicyHandler.WaitAndRetry(2), PolicyHandler.Timeout() })); }