mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 08:27:14 +02:00
Improve Datastore efficiency of duplicate contact messages
I should have caught this in the review, but [] is loading *ALL* contacts individually from Datastore on every domain update. This will add a large number of Datastore round trips and thus significantly reduce update performance. This CL changes the behavior to *ONLY* load contacts when there is a duplicate (which is needed to determine the contact's display name to generate the error message), and loads all of them in a single batch rather than individually. This also makes some minor changes around domain getters returning empty sets instead of null. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=233128140
This commit is contained in:
parent
920d5d0190
commit
49ac4e3e69
3 changed files with 57 additions and 52 deletions
|
@ -786,7 +786,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
assertThat(thrown.getResult().getMsg())
|
||||
.isEqualTo(
|
||||
"More than one contact for a given role is not allowed: "
|
||||
+ "contacts [foo, mak21] have same role [tech]");
|
||||
+ "role [tech] has contacts [foo, mak21]");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -903,10 +903,12 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistReferencedEntities();
|
||||
persistDomain();
|
||||
EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
|
||||
assertThat(thrown.getMessage())
|
||||
.isEqualTo("More than one contact for a given role is not allowed: "
|
||||
+ "contacts [mak21, sh8013] have same role [billing], "
|
||||
+ "contacts [mak21, sh8013] have same role [tech]");
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.isEqualTo(
|
||||
"More than one contact for a given role is not allowed: "
|
||||
+ "role [billing] has contacts [mak21, sh8013], "
|
||||
+ "role [tech] has contacts [mak21, sh8013]");
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue