mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
support retry on transient/too many requests HTTP error
closes #843 ref #836
This commit is contained in:
parent
055282e430
commit
c673b85486
2 changed files with 7 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using CommandLine;
|
||||
using FilterLists.Agent.AppSettings;
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Octokit;
|
||||
using Polly;
|
||||
using Credentials = Octokit.Credentials;
|
||||
using Repository = LibGit2Sharp.Repository;
|
||||
|
||||
|
|
@ -76,7 +78,9 @@ private static void AddAgentHttpClient(this IServiceCollection services)
|
|||
{
|
||||
b.PrimaryHandler = new HttpClientHandler {AllowAutoRedirect = false};
|
||||
b.Build();
|
||||
});
|
||||
}).AddTransientHttpErrorPolicy(b =>
|
||||
b.OrResult(r => r.StatusCode == HttpStatusCode.TooManyRequests)
|
||||
.WaitAndRetryAsync(5, i => i * TimeSpan.FromSeconds(3)));
|
||||
}
|
||||
|
||||
private static void AddGitHubClient(this IServiceCollection services)
|
||||
|
|
|
|||
|
|
@ -40,12 +40,14 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.10.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.7.11" />
|
||||
<PackageReference Include="Octokit" Version="0.32.0" />
|
||||
<PackageReference Include="Polly" Version="7.1.0" />
|
||||
<PackageReference Include="RestSharp" Version="106.6.10" />
|
||||
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue