mirror of
https://github.com/google/nomulus
synced 2026-09-12 11:06:29 +00:00
Remove some appengine dependencies (#1874)
Some retriers are no longer needed because transactions are automatically retried by the JPA transaction manager when there's a transient exception. <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/1874) <!-- Reviewable:end -->
This commit is contained in:
@@ -27,7 +27,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.google.appengine.tools.remoteapi.RemoteApiException;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Splitter;
|
||||
@@ -47,7 +46,6 @@ import google.registry.tools.params.TransitionListParameter.TokenStatusTransitio
|
||||
import google.registry.util.CollectionUtils;
|
||||
import google.registry.util.DomainNameUtils;
|
||||
import google.registry.util.NonFinalForTesting;
|
||||
import google.registry.util.Retrier;
|
||||
import google.registry.util.StringGenerator;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -170,8 +168,6 @@ class GenerateAllocationTokensCommand implements Command {
|
||||
@Named("base58StringGenerator")
|
||||
StringGenerator stringGenerator;
|
||||
|
||||
@Inject Retrier retrier;
|
||||
|
||||
private static final int BATCH_SIZE = 20;
|
||||
private static final Joiner SKIP_NULLS = Joiner.on(',').skipNulls();
|
||||
|
||||
@@ -220,8 +216,7 @@ class GenerateAllocationTokensCommand implements Command {
|
||||
return token.build();
|
||||
})
|
||||
.collect(toImmutableSet());
|
||||
// Wrap in a retrier to deal with transient 404 errors (thrown as RemoteApiExceptions).
|
||||
tokensSaved += retrier.callWithRetry(() -> saveTokens(tokens), RemoteApiException.class);
|
||||
tokensSaved += saveTokens(tokens);
|
||||
} while (tokensSaved < numTokens);
|
||||
}
|
||||
|
||||
@@ -287,7 +282,7 @@ class GenerateAllocationTokensCommand implements Command {
|
||||
if (dryRun) {
|
||||
savedTokens = tokens;
|
||||
} else {
|
||||
tm().transact(() -> tm().transact(() -> tm().putAll(tokens)));
|
||||
tm().transact(() -> tm().putAll(tokens));
|
||||
savedTokens = tm().transact(() -> tm().loadByEntities(tokens));
|
||||
}
|
||||
savedTokens.forEach(
|
||||
|
||||
@@ -18,8 +18,6 @@ import static google.registry.request.Action.Method.POST;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||
|
||||
import com.google.appengine.api.datastore.DatastoreFailureException;
|
||||
import com.google.appengine.api.datastore.DatastoreTimeoutException;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.net.MediaType;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
@@ -86,19 +84,12 @@ public class WhoisAction implements Runnable {
|
||||
try {
|
||||
final WhoisCommand command = whoisReader.readCommand(input, false, now);
|
||||
metricBuilder.setCommand(command);
|
||||
WhoisResponseResults results =
|
||||
retrier.callWithRetry(
|
||||
() -> {
|
||||
WhoisResponseResults results1;
|
||||
try {
|
||||
results1 = command.executeQuery(now).getResponse(PREFER_UNICODE, disclaimer);
|
||||
} catch (WhoisException e) {
|
||||
throw new UncheckedWhoisException(e);
|
||||
}
|
||||
return results1;
|
||||
},
|
||||
DatastoreTimeoutException.class,
|
||||
DatastoreFailureException.class);
|
||||
WhoisResponseResults results;
|
||||
try {
|
||||
results = command.executeQuery(now).getResponse(PREFER_UNICODE, disclaimer);
|
||||
} catch (WhoisException e) {
|
||||
throw new UncheckedWhoisException(e);
|
||||
}
|
||||
responseText = results.plainTextOutput();
|
||||
setWhoisMetrics(metricBuilder, results.numResults(), SC_OK);
|
||||
} catch (UncheckedWhoisException u) {
|
||||
|
||||
Reference in New Issue
Block a user