Skip to content

Commit

Permalink
DefaultDnsCache: apply MAX_SUPPORTED_TTL_SECS cap for `negativeTt…
Browse files Browse the repository at this point in the history
…l` (#13637)

Motivation:

`DefaultDnsCache` already applies `MAX_SUPPORTED_TTL_SECS` as a cap for
`minTtl`/`maxTtl`, but does not apply it for `negativeTtl` that may
suffer from the same problem of scheduling tasks with too big delay on
the `EventLoop`. See

b47fb81

Modifications:

- Apply `MAX_SUPPORTED_TTL_SECS` cap for `negativeTtl` in ctor;

Result:

`negativeTtl` is capped by `MAX_SUPPORTED_TTL_SECS`.
  • Loading branch information
idelpivnitskiy committed Sep 25, 2023
1 parent 7685b7d commit 0394930
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public DefaultDnsCache(int minTtl, int maxTtl, int negativeTtl) {
throw new IllegalArgumentException(
"minTtl: " + minTtl + ", maxTtl: " + maxTtl + " (expected: 0 <= minTtl <= maxTtl)");
}
this.negativeTtl = checkPositiveOrZero(negativeTtl, "negativeTtl");
this.negativeTtl = Math.min(Cache.MAX_SUPPORTED_TTL_SECS, checkPositiveOrZero(negativeTtl, "negativeTtl"));
}

/**
Expand Down

0 comments on commit 0394930

Please sign in to comment.