This commit is contained in:
xljiulang 2021-06-16 00:14:33 +08:00
parent c5c5443922
commit a14720473f
5 changed files with 16 additions and 16 deletions

View File

@ -18,10 +18,10 @@ namespace FastGithub
public static IServiceCollection AddGithubDns(this IServiceCollection services, IConfiguration configuration)
{
var assembly = typeof(DnsServiceCollectionExtensions).Assembly;
return services
.AddGithubScanner(configuration)
return services
.AddServiceAndOptions(assembly, configuration)
.AddHostedService<DnsHostedService>();
.AddHostedService<DnsHostedService>()
.AddGithubScanner(configuration);
}
}
}

View File

@ -2,7 +2,7 @@
namespace FastGithub.Scanner
{
class GithubContextHashSet : HashSet<GithubContext>
sealed class GithubContextHashSet : HashSet<GithubContext>
{
public readonly object SyncRoot = new();
}

View File

@ -3,7 +3,7 @@
namespace FastGithub.Scanner
{
[Options("Github")]
class GithubOptions
sealed class GithubOptions
{
public TimeSpan ScanAllInterval { get; set; } = TimeSpan.FromHours(12d);

View File

@ -73,17 +73,17 @@ namespace FastGithub.Scanner
{
if (domain.Contains("github", StringComparison.OrdinalIgnoreCase))
{
return default;
lock (this.results.SyncRoot)
{
return this.results
.Where(item => item.Domain == domain && item.HttpElapsed != null)
.OrderBy(item => item.HttpElapsed)
.Select(item => item.Address)
.FirstOrDefault();
}
}
lock (this.results.SyncRoot)
{
return this.results
.Where(item => item.Domain == domain && item.HttpElapsed != null)
.OrderBy(item => item.HttpElapsed)
.Select(item => item.Address)
.FirstOrDefault();
}
return default;
}
}
}

View File

@ -6,7 +6,7 @@ using System.Text.Json.Serialization;
namespace FastGithub.Scanner
{
class Meta
sealed class Meta
{
[JsonPropertyName("hooks")]
public string[] Hooks { get; set; } = Array.Empty<string>();
@ -59,6 +59,6 @@ namespace FastGithub.Scanner
}
}
}
}
}
}
}