diff options
author | Harald Musum <musum@yahooinc.com> | 2022-01-12 15:07:22 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-01-12 15:07:22 +0100 |
commit | 93f2af5e853472d0deaabd20490f393df19cb6a2 (patch) | |
tree | 580e674d122031e29d7c8977ad2d05317bf6a8d5 | |
parent | 6fd8eb7f4eeae6bb50e2f7c249bbe10ad40b72dc (diff) |
Use lower timeout
If we get a request for a file reference we don't have, try to download
with 10 second timeout and reply with not found otherwise, otherwise
a thread might be busy for a long time and we might end up with all
threads being busy and no requests can be served
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java | 4 | ||||
-rw-r--r-- | filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java index 81cd1dd9738..8e5eee2104c 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java @@ -27,6 +27,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.time.Duration; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -217,7 +218,8 @@ public class FileServer { return new FileDownloader(configServers.isEmpty() ? FileDownloader.emptyConnectionPool() : createConnectionPool(configServers, supervisor), - supervisor); + supervisor, + Duration.ofSeconds(10)); // set this low, to make sure we don't wait a for a long time in this thread } private static ConnectionPool createConnectionPool(List<String> configServers, Supervisor supervisor) { diff --git a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java index 1821c8971e7..5941ed536a8 100644 --- a/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java +++ b/filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileDownloader.java @@ -27,7 +27,6 @@ import java.util.logging.Logger; public class FileDownloader implements AutoCloseable { private static final Logger log = Logger.getLogger(FileDownloader.class.getName()); - private static final Duration defaultTimeout = Duration.ofMinutes(3); private static final Duration defaultSleepBetweenRetries = Duration.ofSeconds(5); public static final File defaultDownloadDirectory = new File(Defaults.getDefaults().underVespaHome("var/db/vespa/filedistribution")); @@ -38,10 +37,6 @@ public class FileDownloader implements AutoCloseable { private final FileReferenceDownloader fileReferenceDownloader; private final Downloads downloads = new Downloads(); - public FileDownloader(ConnectionPool connectionPool, Supervisor supervisor) { - this(connectionPool, supervisor, defaultDownloadDirectory, defaultTimeout, defaultSleepBetweenRetries); - } - public FileDownloader(ConnectionPool connectionPool, Supervisor supervisor, Duration timeout) { this(connectionPool, supervisor, defaultDownloadDirectory, timeout, defaultSleepBetweenRetries); } |