don't retry if it is taking too long

(cherry picked from commit 8c264ea0441567ca9063dde4ee89c9e8719d69f1)
This commit is contained in:
Stephen Paul Weber 2024-12-09 10:46:10 -05:00 committed by Arne
parent 41d748e0f9
commit 180209c113

View file

@ -486,11 +486,13 @@ public class Resolver {
private static <D extends Data> ListenableFuture<ResolverResult<D>> resolveAsFuture(
final DnsName dnsName, final Class<D> type) {
final var start = System.currentTimeMillis();
return Futures.submit(
() -> {
final Question question = new Question(dnsName, Record.TYPE.getType(type));
if (!DNSSECLESS_TLDS.contains(dnsName.getLabels()[0].toString())) {
for (int i = 0; i < 5; i++) {
if (System.currentTimeMillis() - start > 5000) break;
try {
ResolverResult<D> result = DnssecResolverApi.INSTANCE.resolve(question);
if (result.wasSuccessful() && !result.isAuthenticData()) {