mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
prefer transient registration
This commit is contained in:
parent
e200bad9e5
commit
2f86f635ac
2 changed files with 5 additions and 4 deletions
|
|
@ -9,7 +9,7 @@ public static class ServiceCollectionExtensions
|
|||
{
|
||||
public static void AddApplicationInsights(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton(b =>
|
||||
services.AddTransient(b =>
|
||||
{
|
||||
var applicationInsightsSettings = b.GetService<IOptions<ApplicationInsightsSettings>>().Value;
|
||||
return new TelemetryConfiguration
|
||||
|
|
@ -19,8 +19,8 @@ public static void AddApplicationInsights(this IServiceCollection services)
|
|||
});
|
||||
services.AddSingleton(b =>
|
||||
{
|
||||
var configuration = b.GetService<TelemetryConfiguration>();
|
||||
return new AgentTelemetryClient(configuration);
|
||||
var telemetryConfiguration = b.GetService<TelemetryConfiguration>();
|
||||
return new AgentTelemetryClient(telemetryConfiguration);
|
||||
});
|
||||
services.AddSingleton(b =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ await Task.Run(() =>
|
|||
var logger = services.BuildServiceProvider().GetService<ILogger<IPolicyRegistry<string>>>();
|
||||
logger.LogInformation("Retrying after 429 TooManyRequests",
|
||||
response.Result.RequestMessage.RequestUri,
|
||||
response.Result?.Headers.RetryAfter.Delta.ToString(), retryCount);
|
||||
response.Result?.Headers.RetryAfter.Delta.ToString(),
|
||||
retryCount);
|
||||
});
|
||||
});
|
||||
registry.Add(nameof(waitAndRetryTooManyRequests), waitAndRetryTooManyRequests);
|
||||
|
|
|
|||
Loading…
Reference in a new issue