Make dependency injection and construction of DnsQueue nicer

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146783008
This commit is contained in:
mcilwain 2017-02-07 07:12:05 -08:00 committed by Ben McIlwain
parent 7986be139d
commit f212a53232
4 changed files with 33 additions and 30 deletions

View file

@ -41,6 +41,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.InternetDomainName;
import com.googlecode.objectify.Key;
import dagger.Lazy;
import google.registry.dns.DnsQueue;
import google.registry.flows.EppException;
import google.registry.flows.EppException.AuthorizationErrorException;
@ -109,6 +110,7 @@ public class DomainAllocateFlow implements TransactionalFlow {
@Inject @Superuser boolean isSuperuser;
@Inject HistoryEntry.Builder historyBuilder;
@Inject EppInput eppInput;
@Inject Lazy<DnsQueue> dnsQueue;
@Inject EppResponse.Builder responseBuilder;
@Inject DomainPricingLogic pricingLogic;
@Inject DomainAllocateFlow() {}
@ -360,7 +362,7 @@ public class DomainAllocateFlow implements TransactionalFlow {
private void enqueueTasks(AllocateCreateExtension allocateCreate, DomainResource newDomain) {
if (newDomain.shouldPublishToDns()) {
DnsQueue.create().addDomainRefreshTask(newDomain.getFullyQualifiedDomainName());
dnsQueue.get().addDomainRefreshTask(newDomain.getFullyQualifiedDomainName());
}
if (allocateCreate.getSmdId() != null || allocateCreate.getNotice() != null) {
LordnTask.enqueueDomainResourceTask(newDomain);