添加或更新
This commit is contained in:
parent
849d622bc6
commit
f89952dd18
@ -10,11 +10,19 @@ namespace FastGithub.Scanner
|
||||
private readonly HashSet<GithubContext> contextHashSet = new();
|
||||
private readonly Dictionary<string, IPAddress> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ namespace FastGithub.Scanner
|
||||
await this.fullScanDelegate(context);
|
||||
if (context.Available == true)
|
||||
{
|
||||
this.results.Add(context);
|
||||
this.results.AddOrUpdate(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user