1
0
mirror of https://github.com/google/nomulus synced 2025-12-23 06:15:42 +00:00

Add some basic info logging to RefreshDnsForAllDomainsAction (#2572)

BUG=http://b/369842541
This commit is contained in:
Ben McIlwain
2024-09-26 15:03:08 -04:00
committed by GitHub
parent 72dd8658cf
commit 2b3c6525ff

View File

@@ -108,6 +108,7 @@ public class RefreshDnsForAllDomainsAction implements Runnable {
public void run() { public void run() {
assertTldsExist(tlds); assertTldsExist(tlds);
checkArgument(batchSize > 0, "Must specify a positive number for batch size"); checkArgument(batchSize > 0, "Must specify a positive number for batch size");
logger.atInfo().log("Enqueueing DNS refresh tasks for TLDs %s.", tlds);
Duration smear = tm().transact(TRANSACTION_REPEATABLE_READ, this::calculateSmear); Duration smear = tm().transact(TRANSACTION_REPEATABLE_READ, this::calculateSmear);
ImmutableList<String> domainsBatch; ImmutableList<String> domainsBatch;
@@ -119,6 +120,7 @@ public class RefreshDnsForAllDomainsAction implements Runnable {
TRANSACTION_REPEATABLE_READ, () -> refreshBatch(lastInPreviousBatchOpt, smear)); TRANSACTION_REPEATABLE_READ, () -> refreshBatch(lastInPreviousBatchOpt, smear));
lastInPreviousBatch = domainsBatch.isEmpty() ? null : getLast(domainsBatch); lastInPreviousBatch = domainsBatch.isEmpty() ? null : getLast(domainsBatch);
} while (domainsBatch.size() == batchSize); } while (domainsBatch.size() == batchSize);
logger.atInfo().log("Finished enqueueing DNS refresh tasks.");
} }
/** /**
@@ -134,7 +136,9 @@ public class RefreshDnsForAllDomainsAction implements Runnable {
.setParameter("tlds", tlds) .setParameter("tlds", tlds)
.setParameter("activeOrDeletedSince", activeOrDeletedSince) .setParameter("activeOrDeletedSince", activeOrDeletedSince)
.getSingleResult(); .getSingleResult();
return Duration.standardSeconds(Math.max(activeDomains / refreshQps, 1)); Duration smear = Duration.standardSeconds(Math.max(activeDomains / refreshQps, 1));
logger.atInfo().log("Smearing %d domain DNS refresh tasks across %s.", activeDomains, smear);
return smear;
} }
private ImmutableList<String> getBatch(Optional<String> lastInPreviousBatch) { private ImmutableList<String> getBatch(Optional<String> lastInPreviousBatch) {