From 3004842a186f62569c1f1c85aa9a102dc5b8248f Mon Sep 17 00:00:00 2001 From: xljiulang <366193849@qq.com> Date: Sat, 19 Jun 2021 12:33:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9HttpClient=E5=AD=98=E6=B4=BB?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.Scanner/GithubScanService.cs | 8 ++++++-- FastGithub.Scanner/ScannerServiceCollectionExtensions.cs | 2 +- FastGithub/FastGithub.csproj | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/FastGithub.Scanner/GithubScanService.cs b/FastGithub.Scanner/GithubScanService.cs index 7397d7b..ab215d7 100644 --- a/FastGithub.Scanner/GithubScanService.cs +++ b/FastGithub.Scanner/GithubScanService.cs @@ -88,13 +88,17 @@ namespace FastGithub.Scanner { 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) { await this.resultScanDelegate(context); } - this.logger.LogInformation($"结果扫描结束,共扫描{contexts.Length}条记录"); + this.logger.LogInformation($"结果扫描结束,共扫描{results.Length}条记录"); } } } diff --git a/FastGithub.Scanner/ScannerServiceCollectionExtensions.cs b/FastGithub.Scanner/ScannerServiceCollectionExtensions.cs index e945c8a..9afbc5e 100644 --- a/FastGithub.Scanner/ScannerServiceCollectionExtensions.cs +++ b/FastGithub.Scanner/ScannerServiceCollectionExtensions.cs @@ -25,7 +25,7 @@ namespace FastGithub services .AddHttpClient(nameof(FastGithub)) - .SetHandlerLifetime(TimeSpan.FromMinutes(10d)) + .SetHandlerLifetime(TimeSpan.FromMinutes(5d)) .ConfigureHttpClient(httpClient => { httpClient.DefaultRequestHeaders.Accept.TryParseAdd("*/*"); diff --git a/FastGithub/FastGithub.csproj b/FastGithub/FastGithub.csproj index 609b7d4..b86aa63 100644 --- a/FastGithub/FastGithub.csproj +++ b/FastGithub/FastGithub.csproj @@ -4,9 +4,10 @@ Exe enable net5.0;net6.0 - 1.0.0-beta3 + 1.0.0-beta4 github定制版的dns服务,解析github最优的ip MIT + https://github.com/xljiulang/FastGithub