fix bug
This commit is contained in:
parent
c5c5443922
commit
a14720473f
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace FastGithub.Scanner
|
||||
{
|
||||
class GithubContextHashSet : HashSet<GithubContext>
|
||||
sealed class GithubContextHashSet : HashSet<GithubContext>
|
||||
{
|
||||
public readonly object SyncRoot = new();
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
namespace FastGithub.Scanner
|
||||
{
|
||||
[Options("Github")]
|
||||
class GithubOptions
|
||||
sealed class GithubOptions
|
||||
{
|
||||
public TimeSpan ScanAllInterval { get; set; } = TimeSpan.FromHours(12d);
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user