非超时异常缓存
This commit is contained in:
parent
8e2e3802f0
commit
059907faf5
@ -124,8 +124,7 @@ namespace FastGithub.DomainResolve
|
|||||||
}
|
}
|
||||||
|
|
||||||
var result = await this.LookupCoreAsync(dns, endPoint, fastSort, cancellationToken);
|
var result = await this.LookupCoreAsync(dns, endPoint, fastSort, cancellationToken);
|
||||||
this.dnsCache.Set(key, result.Addresses, result.TimeToLive);
|
return this.dnsCache.Set(key, result.Addresses, result.TimeToLive);
|
||||||
return result.Addresses;
|
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
@ -135,7 +134,7 @@ namespace FastGithub.DomainResolve
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.logger.LogWarning($"dns://{dns}无法解析{endPoint.Host}:{ex.Message}");
|
this.logger.LogWarning($"dns://{dns}无法解析{endPoint.Host}:{ex.Message}");
|
||||||
return Array.Empty<IPAddress>();
|
return this.dnsCache.Set(key, Array.Empty<IPAddress>(), this.maxTimeToLive);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user