mirror of
https://github.com/google/nomulus
synced 2026-09-25 09:24:18 +00:00
Fix some small transactional issues in SQL mode (#1662)
* Fix some small transactional issues in SQL mode These weren't caught until I switched the default database type in tests to be SQL (separate PR). Fortunately these don't seem to be catastrophic
This commit is contained in:
@@ -49,11 +49,14 @@ final class GetAllocationTokenCommand implements CommandWithRemoteApi {
|
||||
tokens.stream()
|
||||
.map(t -> VKey.create(AllocationToken.class, t))
|
||||
.collect(toImmutableList());
|
||||
tm().loadByKeysIfPresent(tokenKeys)
|
||||
.forEach((k, v) -> builder.put(k.getSqlKey().toString(), v));
|
||||
tm().transact(
|
||||
() ->
|
||||
tm().loadByKeysIfPresent(tokenKeys)
|
||||
.forEach((k, v) -> builder.put(k.getSqlKey().toString(), v)));
|
||||
}
|
||||
ImmutableMap<String, AllocationToken> loadedTokens = builder.build();
|
||||
ImmutableMap<VKey<DomainBase>, DomainBase> domains = loadRedeemedDomains(loadedTokens.values());
|
||||
ImmutableMap<VKey<DomainBase>, DomainBase> domains =
|
||||
tm().transact(() -> loadRedeemedDomains(loadedTokens.values()));
|
||||
|
||||
for (String token : mainParameters) {
|
||||
if (loadedTokens.containsKey(token)) {
|
||||
|
||||
@@ -204,7 +204,8 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand {
|
||||
|
||||
private ImmutableSortedSet<String> getExistingNameservers(DomainBase domain) {
|
||||
ImmutableSortedSet.Builder<String> nameservers = ImmutableSortedSet.naturalOrder();
|
||||
for (HostResource host : tm().loadByKeys(domain.getNameservers()).values()) {
|
||||
for (HostResource host :
|
||||
tm().transact(() -> tm().loadByKeys(domain.getNameservers()).values())) {
|
||||
nameservers.add(host.getForeignKey());
|
||||
}
|
||||
return nameservers.build();
|
||||
|
||||
Reference in New Issue
Block a user