diff --git a/FastGithub.DomainResolve/DomainResolveHostedService.cs b/FastGithub.DomainResolve/DomainResolveHostedService.cs index e2ca4e5..c559d32 100644 --- a/FastGithub.DomainResolve/DomainResolveHostedService.cs +++ b/FastGithub.DomainResolve/DomainResolveHostedService.cs @@ -45,7 +45,7 @@ namespace FastGithub.DomainResolve while (stoppingToken.IsCancellationRequested == false) { - await this.domainResolver.TestAllEndPointsAsync(stoppingToken); + await this.domainResolver.TestSpeedAsync(stoppingToken); await Task.Delay(this.testPeriodTimeSpan, stoppingToken); } } diff --git a/FastGithub.DomainResolve/DomainResolver.cs b/FastGithub.DomainResolve/DomainResolver.cs index a588ad5..b29c577 100644 --- a/FastGithub.DomainResolve/DomainResolver.cs +++ b/FastGithub.DomainResolve/DomainResolver.cs @@ -43,7 +43,7 @@ namespace FastGithub.DomainResolve { this.dnsEndPointAddress.TryAdd(endPoint, Array.Empty()); } - } + } /// /// 解析域名 @@ -79,9 +79,9 @@ namespace FastGithub.DomainResolve /// /// /// - public async Task TestAllEndPointsAsync(CancellationToken cancellationToken) + public async Task TestSpeedAsync(CancellationToken cancellationToken) { - foreach (var keyValue in this.dnsEndPointAddress) + foreach (var keyValue in this.dnsEndPointAddress.OrderBy(item => item.Value.Length)) { var dnsEndPoint = keyValue.Key; var oldAddresses = keyValue.Value; diff --git a/FastGithub.DomainResolve/IDomainResolver.cs b/FastGithub.DomainResolve/IDomainResolver.cs index 5f8af9c..35007b8 100644 --- a/FastGithub.DomainResolve/IDomainResolver.cs +++ b/FastGithub.DomainResolve/IDomainResolver.cs @@ -23,6 +23,6 @@ namespace FastGithub.DomainResolve /// /// /// - Task TestAllEndPointsAsync(CancellationToken cancellationToken = default); + Task TestSpeedAsync(CancellationToken cancellationToken = default); } } \ No newline at end of file