aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
index 11a6119bae..9201c94858 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
@@ -16,6 +16,8 @@ package com.google.devtools.build.lib.remote;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
+import com.google.common.util.concurrent.ListeningScheduledExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
import com.google.devtools.build.lib.authandtls.AuthAndTLSOptions;
import com.google.devtools.build.lib.authandtls.GoogleAuthUtils;
import com.google.devtools.build.lib.buildeventstream.PathConverter;
@@ -40,6 +42,7 @@ import com.google.devtools.remoteexecution.v1test.Digest;
import io.grpc.Channel;
import io.grpc.ClientInterceptors;
import java.io.IOException;
+import java.util.concurrent.Executors;
import java.util.logging.Logger;
/** RemoteModule provides distributed cache and remote execution for Bazel. */
@@ -87,7 +90,8 @@ public final class RemoteModule extends BlazeModule {
}
private final CasPathConverter converter = new CasPathConverter();
-
+ private final ListeningScheduledExecutorService retryScheduler =
+ MoreExecutors.listeningDecorator(Executors.newScheduledThreadPool(1));
private RemoteActionContextProvider actionContextProvider;
@Override
@@ -149,11 +153,14 @@ public final class RemoteModule extends BlazeModule {
logger = new LoggingInterceptor(rpcLogFile, env.getRuntime().getClock());
}
- RemoteRetrier retrier =
- new RemoteRetrier(
- remoteOptions, RemoteRetrier.RETRIABLE_GRPC_ERRORS, Retrier.ALLOW_ALL_CALLS);
final AbstractRemoteActionCache cache;
if (enableBlobStoreCache) {
+ Retrier retrier =
+ new Retrier(
+ () -> Retrier.RETRIES_DISABLED,
+ (e) -> false,
+ retryScheduler,
+ Retrier.ALLOW_ALL_CALLS);
cache =
new SimpleBlobStoreActionCache(
remoteOptions,
@@ -161,6 +168,7 @@ public final class RemoteModule extends BlazeModule {
remoteOptions,
GoogleAuthUtils.newCredentials(authAndTlsOptions),
env.getWorkingDirectory()),
+ retrier,
digestUtil);
} else if (enableGrpcCache || remoteOptions.remoteExecutor != null) {
// If a remote executor but no remote cache is specified, assume both at the same target.
@@ -169,6 +177,12 @@ public final class RemoteModule extends BlazeModule {
if (logger != null) {
ch = ClientInterceptors.intercept(ch, logger);
}
+ RemoteRetrier retrier =
+ new RemoteRetrier(
+ remoteOptions,
+ RemoteRetrier.RETRIABLE_GRPC_ERRORS,
+ retryScheduler,
+ Retrier.ALLOW_ALL_CALLS);
cache =
new GrpcRemoteCache(
ch,
@@ -180,11 +194,15 @@ public final class RemoteModule extends BlazeModule {
cache = null;
}
- // TODO(davido): The naming is wrong here. "Remote"-prefix in RemoteActionCache class has no
- // meaning.
final GrpcRemoteExecutor executor;
if (remoteOptions.remoteExecutor != null) {
Channel ch = GoogleAuthUtils.newChannel(remoteOptions.remoteExecutor, authAndTlsOptions);
+ RemoteRetrier retrier =
+ new RemoteRetrier(
+ remoteOptions,
+ RemoteRetrier.RETRIABLE_GRPC_ERRORS,
+ retryScheduler,
+ Retrier.ALLOW_ALL_CALLS);
if (logger != null) {
ch = ClientInterceptors.intercept(ch, logger);
}