1
0
mirror of https://github.com/google/nomulus synced 2026-01-06 21:47:31 +00:00

Separate load and verify transaction from refresh transaction in RefreshDnsAction (#2055)

This commit is contained in:
sarahcaseybot
2023-06-13 18:12:08 -04:00
committed by GitHub
parent bc57f319e5
commit 952a92a5db

View File

@@ -60,21 +60,18 @@ public final class RefreshDnsAction implements Runnable {
if (!domainOrHostName.contains(".")) {
throw new BadRequestException("URL parameter 'name' must be fully qualified");
}
tm().transact(
() -> {
switch (type) {
case DOMAIN:
loadAndVerifyExistence(Domain.class, domainOrHostName);
requestDomainDnsRefresh(domainOrHostName);
break;
case HOST:
verifyHostIsSubordinate(loadAndVerifyExistence(Host.class, domainOrHostName));
requestHostDnsRefresh(domainOrHostName);
break;
default:
throw new BadRequestException("Unsupported type: " + type);
}
});
switch (type) {
case DOMAIN:
loadAndVerifyExistence(Domain.class, domainOrHostName);
tm().transact(() -> requestDomainDnsRefresh(domainOrHostName));
break;
case HOST:
verifyHostIsSubordinate(loadAndVerifyExistence(Host.class, domainOrHostName));
tm().transact(() -> requestHostDnsRefresh(domainOrHostName));
break;
default:
throw new BadRequestException("Unsupported type: " + type);
}
}
private <T extends EppResource & ForeignKeyedEppResource>