aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/buildeventservice
diff options
context:
space:
mode:
authorGravatar buchgr <buchgr@google.com>2018-07-22 04:05:12 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-22 04:06:55 -0700
commit1cb4dcf3bb6b40f536f1774a036c8bb30d9e329b (patch)
tree152458768b897b58e6e2dbc4b800d31832a6f63d /src/main/java/com/google/devtools/build/lib/buildeventservice
parent8dc77037cf73e4e0d1300aaa4143145e61c7d267 (diff)
bes: don't retry all status codes
don't retry precondition_failed and invalid_argument status codes. RELNOTES: None PiperOrigin-RevId: 205566423
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventservice')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java
index fa2fb67b24..e62f2df64b 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java
+++ b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceTransport.java
@@ -26,6 +26,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
@@ -57,6 +58,7 @@ import com.google.devtools.build.v1.PublishBuildToolEventStreamResponse;
import com.google.devtools.build.v1.PublishLifecycleEventRequest;
import com.google.protobuf.Any;
import io.grpc.Status;
+import io.grpc.Status.Code;
import io.grpc.StatusException;
import java.time.Duration;
import java.util.Collection;
@@ -85,6 +87,9 @@ public class BuildEventServiceTransport implements BuildEventTransport {
static final String UPLOAD_SUCCEEDED_MESSAGE =
"Build Event Protocol upload finished successfully.";
+ static final Set<Code> CODES_NOT_TO_RETRY =
+ Sets.newHashSet(Code.INVALID_ARGUMENT, Code.FAILED_PRECONDITION);
+
private static final Logger logger = Logger.getLogger(BuildEventServiceTransport.class.getName());
/** Max wait time until for the Streaming RPC to finish after all events were sent. */
@@ -597,11 +602,13 @@ public class BuildEventServiceTransport implements BuildEventTransport {
c.call();
lastRetryError = null;
return;
- } catch (InterruptedException e) {
- throw e;
} catch (LocalFileUploadException e) {
throw (Exception) e.getCause();
} catch (StatusException e) {
+ if (CODES_NOT_TO_RETRY.contains(e.getStatus().getCode())) {
+ throw e;
+ }
+
if (acksReceivedSinceLastRetry.get() > 0) {
logger.fine(
String.format(