修改HttpClient存活时间

This commit is contained in:
xljiulang 2021-06-19 12:33:03 +08:00
parent d3b890728f
commit 3004842a18
3 changed files with 9 additions and 4 deletions

View File

@ -88,13 +88,17 @@ namespace FastGithub.Scanner
{ {
this.logger.LogInformation("结果扫描开始.."); this.logger.LogInformation("结果扫描开始..");
var contexts = this.scanResults.ToArray(); var results = this.scanResults.ToArray();
var contexts = results
.OrderByDescending(item => item.History.AvailableRate)
.ThenBy(item => item.History.AvgElapsed);
foreach (var context in contexts) foreach (var context in contexts)
{ {
await this.resultScanDelegate(context); await this.resultScanDelegate(context);
} }
this.logger.LogInformation($"结果扫描结束,共扫描{contexts.Length}条记录"); this.logger.LogInformation($"结果扫描结束,共扫描{results.Length}条记录");
} }
} }
} }

View File

@ -25,7 +25,7 @@ namespace FastGithub
services services
.AddHttpClient(nameof(FastGithub)) .AddHttpClient(nameof(FastGithub))
.SetHandlerLifetime(TimeSpan.FromMinutes(10d)) .SetHandlerLifetime(TimeSpan.FromMinutes(5d))
.ConfigureHttpClient(httpClient => .ConfigureHttpClient(httpClient =>
{ {
httpClient.DefaultRequestHeaders.Accept.TryParseAdd("*/*"); httpClient.DefaultRequestHeaders.Accept.TryParseAdd("*/*");

View File

@ -4,9 +4,10 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks> <TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<Version>1.0.0-beta3</Version> <Version>1.0.0-beta4</Version>
<Description>github定制版的dns服务解析github最优的ip</Description> <Description>github定制版的dns服务解析github最优的ip</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>https://github.com/xljiulang/FastGithub</Copyright>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'"> <PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">