Simplify the logic for checking for finding linked contacts/hosts.

This is preparatory refactoring for the next CL, which gets rid
of cloneWithLinkedStatus

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=145424322
This commit is contained in:
cgoldfeder 2017-01-24 08:56:26 -08:00 committed by Ben McIlwain
parent b5cf58bf2c
commit 2bb61b82f4
2 changed files with 25 additions and 18 deletions

View file

@ -20,7 +20,7 @@ import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Iterables.tryFind;
import static com.google.common.collect.Sets.intersection;
import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.EppResourceUtils.queryDomainsUsingResource;
import static google.registry.model.EppResourceUtils.queryForLinkedDomains;
import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
import static google.registry.model.index.ForeignKeyIndex.loadAndGetKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
@ -189,8 +189,8 @@ public final class ResourceFlowUtils {
// eventually consistent and so might be very stale, but the direct load will not be stale,
// just non-transactional. If we find at least one actual reference then we can reliably
// fail. If we don't find any, we can't trust the query and need to do the full mapreduce.
List<Key<DomainBase>> keys = queryDomainsUsingResource(
resourceClass, fki.getResourceKey(), now, FAILFAST_CHECK_COUNT);
Iterable<Key<DomainBase>> keys =
queryForLinkedDomains(fki.getResourceKey(), now).limit(FAILFAST_CHECK_COUNT).keys();
Predicate<DomainBase> predicate = new Predicate<DomainBase>() {
@Override
public boolean apply(DomainBase domain) {