Move domainCreateFailfast before cloneAndLinkReferences

This avoids loading all contacts and hosts before the failfast runs

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154179321
This commit is contained in:
cgoldfeder 2017-04-25 09:08:25 -07:00 committed by Ben McIlwain
parent 33fabfff04
commit 4553422ade
3 changed files with 3 additions and 3 deletions

View file

@ -139,8 +139,8 @@ public class DomainAllocateFlow implements TransactionalFlow {
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
verifyIsSuperuser(); verifyIsSuperuser();
DateTime now = ofy().getTransactionTime(); DateTime now = ofy().getTransactionTime();
Create command = cloneAndLinkReferences((Create) resourceCommand, now);
failfastForCreate(targetId, now); failfastForCreate(targetId, now);
Create command = cloneAndLinkReferences((Create) resourceCommand, now);
verifyResourceDoesNotExist(DomainResource.class, targetId, now); verifyResourceDoesNotExist(DomainResource.class, targetId, now);
InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName()); InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName());
Registry registry = Registry.get(domainName.parent().toString()); Registry registry = Registry.get(domainName.parent().toString());

View file

@ -195,8 +195,8 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime(); DateTime now = ofy().getTransactionTime();
Create command = cloneAndLinkReferences((Create) resourceCommand, now);
failfastForCreate(targetId, now); failfastForCreate(targetId, now);
Create command = cloneAndLinkReferences((Create) resourceCommand, now);
// Fail if the domain is already registered (e.g. this is a landrush application but the domain // Fail if the domain is already registered (e.g. this is a landrush application but the domain
// was awarded at the end of sunrise). However, multiple domain applications can be created for // was awarded at the end of sunrise). However, multiple domain applications can be created for
// the same domain name, so don't try to load an existing application. // the same domain name, so don't try to load an existing application.

View file

@ -193,12 +193,12 @@ public class DomainCreateFlow implements TransactionalFlow {
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime(); DateTime now = ofy().getTransactionTime();
failfastForCreate(targetId, now);
Create command = cloneAndLinkReferences((Create) resourceCommand, now); Create command = cloneAndLinkReferences((Create) resourceCommand, now);
Period period = command.getPeriod(); Period period = command.getPeriod();
verifyUnitIsYears(period); verifyUnitIsYears(period);
int years = period.getValue(); int years = period.getValue();
validateRegistrationPeriod(years); validateRegistrationPeriod(years);
failfastForCreate(targetId, now);
verifyResourceDoesNotExist(DomainResource.class, targetId, now); verifyResourceDoesNotExist(DomainResource.class, targetId, now);
// Validate that this is actually a legal domain name on a TLD that the registrar has access to. // Validate that this is actually a legal domain name on a TLD that the registrar has access to.
InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName()); InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName());