diff --git a/FastGithub.Scanner/GithubContextCollection.cs b/FastGithub.Scanner/GithubContextCollection.cs index 5c01444..3abf00d 100644 --- a/FastGithub.Scanner/GithubContextCollection.cs +++ b/FastGithub.Scanner/GithubContextCollection.cs @@ -10,11 +10,19 @@ namespace FastGithub.Scanner private readonly HashSet contextHashSet = new(); private readonly Dictionary domainAdressCache = new(); - public bool Add(GithubContext context) + public void AddOrUpdate(GithubContext context) { lock (this.syncRoot) { - return this.contextHashSet.Add(context); + if (this.contextHashSet.TryGetValue(context, out var value)) + { + value.Elapsed = context.Elapsed; + value.Available = context.Available; + } + else + { + this.contextHashSet.Add(context); + } } } diff --git a/FastGithub.Scanner/GithubScanService.cs b/FastGithub.Scanner/GithubScanService.cs index a1d3d7d..480b573 100644 --- a/FastGithub.Scanner/GithubScanService.cs +++ b/FastGithub.Scanner/GithubScanService.cs @@ -62,7 +62,7 @@ namespace FastGithub.Scanner await this.fullScanDelegate(context); if (context.Available == true) { - this.results.Add(context); + this.results.AddOrUpdate(context); } } }