xljiulang 4 ani în urmă
părinte
comite
a14720473f

+ 3 - 3
FastGithub.Dns/DnsServiceCollectionExtensions.cs

@@ -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);
         }
     }
 }

+ 1 - 1
FastGithub.Scanner/GithubContextHashSet.cs

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

+ 1 - 1
FastGithub.Scanner/GithubOptions.cs

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

+ 9 - 9
FastGithub.Scanner/GithubScanService.cs

@@ -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;
         }
     }
 }

+ 2 - 2
FastGithub.Scanner/Meta.cs

@@ -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
                     }
                 }
             }
-        } 
+        }
     }
 }