mirror of
https://github.com/google/nomulus
synced 2026-09-05 23:57:01 +00: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:
@@ -403,7 +403,7 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
|
|||||||
public static ImmutableMap<VKey<? extends EppResource>, EppResource> loadCached(
|
public static ImmutableMap<VKey<? extends EppResource>, EppResource> loadCached(
|
||||||
Iterable<VKey<? extends EppResource>> keys) {
|
Iterable<VKey<? extends EppResource>> keys) {
|
||||||
if (!RegistryConfig.isEppResourceCachingEnabled()) {
|
if (!RegistryConfig.isEppResourceCachingEnabled()) {
|
||||||
return tm().loadByKeys(keys);
|
return tm().transact(() -> tm().loadByKeys(keys));
|
||||||
}
|
}
|
||||||
return ImmutableMap.copyOf(cacheEppResources.getAll(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) {
|
public static <T extends EppResource> T loadCached(VKey<T> key) {
|
||||||
if (!RegistryConfig.isEppResourceCachingEnabled()) {
|
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.
|
// Safe to cast because loading a Key<T> returns an entity of type T.
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
Reference in New Issue
Block a user