From 84cbd8f7631cf0f67c331d9690cbb2f13ca3054b Mon Sep 17 00:00:00 2001 From: gbrodman Date: Tue, 17 Aug 2021 13:20:17 -0600 Subject: [PATCH] Use direct ofyTm reference when clearing cache in tool (#1287) We shouldn't reference tm() at all before initializing the JPA transaction manager, since tm() looks at the database migration schedule when figuring out which transaction manager to use. --- core/src/main/java/google/registry/tools/RegistryCli.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/google/registry/tools/RegistryCli.java b/core/src/main/java/google/registry/tools/RegistryCli.java index d506f94ef..20e41dbf5 100644 --- a/core/src/main/java/google/registry/tools/RegistryCli.java +++ b/core/src/main/java/google/registry/tools/RegistryCli.java @@ -15,7 +15,7 @@ package google.registry.tools; import static com.google.common.base.Preconditions.checkState; -import static google.registry.persistence.transaction.TransactionManagerFactory.tm; +import static google.registry.persistence.transaction.TransactionManagerFactory.ofyTm; import static google.registry.tools.Injector.injectReflectively; import static java.nio.charset.StandardCharsets.UTF_8; @@ -244,7 +244,7 @@ final class RegistryCli implements AutoCloseable, CommandRunner { ObjectifyService.initOfy(); // Make sure we start the command with a clean cache, so that any previous command won't // interfere with this one. - tm().clearSessionCache(); + ofyTm().clearSessionCache(); // Enable Cloud SQL for command that needs remote API as they will very likely use // Cloud SQL after the database migration. Note that the DB password is stored in Datastore