mirror of
https://github.com/google/nomulus.git
synced 2025-04-29 19:47:51 +02:00
Wrap tm().loadByKey() in a transaction when caching is not enabled. (#2030)
We have caching enabled so we never exercised this line.
This commit is contained in:
parent
811fcf9f43
commit
1a5eb40fb5
1 changed files with 2 additions and 2 deletions
|
@ -403,7 +403,7 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
|||
public static ImmutableMap<VKey<? extends EppResource>, EppResource> loadCached(
|
||||
Iterable<VKey<? extends EppResource>> keys) {
|
||||
if (!RegistryConfig.isEppResourceCachingEnabled()) {
|
||||
return tm().loadByKeys(keys);
|
||||
return tm().transact(() -> tm().loadByKeys(keys));
|
||||
}
|
||||
return ImmutableMap.copyOf(cacheEppResources.getAll(keys));
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
|||
*/
|
||||
public static <T extends EppResource> T loadCached(VKey<T> key) {
|
||||
if (!RegistryConfig.isEppResourceCachingEnabled()) {
|
||||
return tm().loadByKey(key);
|
||||
return tm().transact(() -> tm().loadByKey(key));
|
||||
}
|
||||
// Safe to cast because loading a Key<T> returns an entity of type T.
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
Loading…
Add table
Reference in a new issue