You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by "srijeet0406 (via GitHub)" <gi...@apache.org> on 2023/08/18 17:03:11 UTC
[GitHub] [trafficcontrol] srijeet0406 commented on a diff in pull request #7732: Increase negative TTL to 900 seconds for NXDOMAIN responses
srijeet0406 commented on code in PR #7732:
URL: https://github.com/apache/trafficcontrol/pull/7732#discussion_r1298672341
##########
traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/dns/NameServer.java:
##########
@@ -328,11 +329,19 @@ private static RRset setNegativeTTL(final RRset original, final int flags) {
if (record instanceof SOARecord) {
final SOARecord soa = (SOARecord) record;
+ // Set the "minimum" attribute to be the maximum of the current minimum value and 900 (seconds)
+ // This is done to increase the negative caching TTL, so as to maximize the time interval between
+ // successive NXDOMAIN or NXRRSET responses.
+ final long minimum = Math.max(soa.getMinimum(), negativeCachingTTL);
+ record = new SOARecord(soa.getName(), DClass.IN, soa.getTTL(), soa.getHost(), soa.getAdmin(),
+ soa.getSerial(), soa.getRefresh(), soa.getRetry(), soa.getExpire(),
+ minimum);
+
// the value of the minimum field is less than the actual TTL; adjust
if (soa.getMinimum() != 0 || soa.getTTL() > soa.getMinimum()) {
record = new SOARecord(soa.getName(), DClass.IN, soa.getMinimum(), soa.getHost(), soa.getAdmin(),
soa.getSerial(), soa.getRefresh(), soa.getRetry(), soa.getExpire(),
- soa.getMinimum());
+ minimum);
} // else use the unmodified record
Review Comment:
I was actually going to do that, but then I realized that `record` doesn't have a setter method for TTL, so I have to redeclare the complete value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org