Don't reset the update time for TLD updates (#1532)

* Don't reset the update time for TLD updates

It turns out that the reason that the Registrar update timestamp isn't updated
for some of the tests is because the record is updated unchanged.  We can
avoid this problem by not trying to update the registrar to the same value.
So in this case, if the registrar alreay contains the TLD we're adding, don't
try to add it.
This commit is contained in:
Michael Muller 2022-02-25 13:09:36 -05:00 committed by GitHub
parent f7b105e96b
commit fbdee623de
2 changed files with 4 additions and 3 deletions

View file

@ -825,7 +825,6 @@ public class Registrar extends ImmutableObject
public Builder setAllowedTlds(Set<String> allowedTlds) {
getInstance().allowedTlds = ImmutableSortedSet.copyOf(assertTldsExist(allowedTlds));
getInstance().lastUpdateTime = UpdateAutoTimestamp.create(null);
return this;
}

View file

@ -472,8 +472,10 @@ public class DatabaseHelper {
public static void allowRegistrarAccess(String registrarId, String tld) {
Registrar registrar = loadRegistrar(registrarId);
persistResource(
registrar.asBuilder().setAllowedTlds(union(registrar.getAllowedTlds(), tld)).build());
if (!registrar.getAllowedTlds().contains(tld)) {
persistResource(
registrar.asBuilder().setAllowedTlds(union(registrar.getAllowedTlds(), tld)).build());
}
}
public static void disallowRegistrarAccess(String registrarId, String tld) {