diff options
author | Harald Musum <musum@verizonmedia.com> | 2021-03-01 17:41:09 +0100 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2021-03-01 17:41:09 +0100 |
commit | c841479866487e4fe56fe8d89281833b88ad5aaf (patch) | |
tree | c20a5965186ff0b7bbbc1f103d4d153915dd1fb5 /filedistribution/src/main | |
parent | ed4efd875596969e177fee409c311a4fc35a7b0c (diff) |
Increase RPC timeout for getting files and use environment variable if set
Diffstat (limited to 'filedistribution/src/main')
-rw-r--r-- | filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java index 7e14e94823b..e77e8530f03 100644 --- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java +++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReferenceDownloader.java @@ -35,7 +35,6 @@ import java.util.stream.Collectors; public class FileReferenceDownloader { private final static Logger log = Logger.getLogger(FileReferenceDownloader.class.getName()); - private final static Duration rpcTimeout = Duration.ofSeconds(10); private final ExecutorService downloadExecutor = Executors.newFixedThreadPool(Math.max(8, Runtime.getRuntime().availableProcessors()), @@ -47,6 +46,7 @@ public class FileReferenceDownloader { private final DownloadStatuses downloadStatuses = new DownloadStatuses(); private final Duration downloadTimeout; private final Duration sleepBetweenRetries; + private final Duration rpcTimeout; FileReferenceDownloader(File downloadDirectory, File tmpDirectory, ConnectionPool connectionPool, Duration timeout, Duration sleepBetweenRetries) { this.connectionPool = connectionPool; @@ -54,6 +54,8 @@ public class FileReferenceDownloader { this.sleepBetweenRetries = sleepBetweenRetries; // Needed to receive RPC calls receiveFile* from server after asking for files new FileReceiver(connectionPool.getSupervisor(), this, downloadDirectory, tmpDirectory); + String timeoutString = System.getenv("VESPA_CONFIGPROXY_FILEDOWNLOAD_RPC_TIMEOUT"); + this.rpcTimeout = Duration.ofSeconds(timeoutString == null ? 30 : Integer.parseInt(timeoutString)); } private void startDownload(FileReferenceDownload fileReferenceDownload) { @@ -128,8 +130,8 @@ public class FileReferenceDownloader { } } else { log.log(logLevel, () -> "Request failed. Req: " + request + "\nSpec: " + connection.getAddress() + - ", error code: " + request.errorCode() + ", set error for spec, use another spec for next request" + - ", retry count " + retryCount); + ", error code: " + request.errorCode() + ", will use another spec for next request" + + ", retry count " + retryCount + ", rpc timeout " + rpcTimeout.getSeconds()); connectionPool.setError(connection, request.errorCode()); return false; } |