其它异常也缓存

This commit is contained in:
陈国伟 2021-11-24 09:21:56 +08:00
parent b5647312bf
commit aba0ea7c2f

View File

@ -133,12 +133,12 @@ namespace FastGithub.DomainResolve
catch (SocketException ex) catch (SocketException ex)
{ {
this.logger.LogWarning($"{endPoint.Host}@{dns}{ex.Message}"); this.logger.LogWarning($"{endPoint.Host}@{dns}{ex.Message}");
return this.dnsCache.Set(key, Array.Empty<IPAddress>(), this.maxTimeToLive); return this.dnsCache.Set(key, Array.Empty<IPAddress>(), this.minTimeToLive);
} }
catch (Exception ex) catch (Exception ex)
{ {
this.logger.LogWarning($"{endPoint.Host}@{dns}{ex.Message}"); this.logger.LogWarning($"{endPoint.Host}@{dns}{ex.Message}");
return Array.Empty<IPAddress>(); return this.dnsCache.Set(key, Array.Empty<IPAddress>(), this.minTimeToLive);
} }
finally finally
{ {