From 9f548674b75e282a72e96bc17c559f7c8d483908 Mon Sep 17 00:00:00 2001 From: mcilwain Date: Fri, 18 Mar 2016 08:28:27 -0700 Subject: [PATCH] Use fewer simultaneous connections to Directory API Ten turns out to have been set too high; that will occasionally throw 500 Backend errors from the API (presumably having to do with rate-limiting). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=117549363 --- .../domain/registry/tools/server/CreateGroupsAction.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/com/google/domain/registry/tools/server/CreateGroupsAction.java b/java/com/google/domain/registry/tools/server/CreateGroupsAction.java index 678d097dd..27e69159c 100644 --- a/java/com/google/domain/registry/tools/server/CreateGroupsAction.java +++ b/java/com/google/domain/registry/tools/server/CreateGroupsAction.java @@ -50,6 +50,7 @@ public class CreateGroupsAction implements Runnable { public static final String CLIENT_ID_PARAM = "clientId"; private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass(); + private static final int NUM_SIMULTANEOUS_CONNECTIONS = 5; @Inject GroupsConnection groupsConnection; @Inject Response response; @@ -66,7 +67,9 @@ public class CreateGroupsAction implements Runnable { List types = asList(RegistrarContact.Type.values()); // Concurrently create the groups for each RegistrarContact.Type, collecting the results from // each call (which are either an Exception if it failed, or absent() if it succeeded). - List> results = Concurrent.transform(types, + List> results = Concurrent.transform( + types, + NUM_SIMULTANEOUS_CONNECTIONS, new Function>() { @Override public Optional apply(Type type) {