diff options
author | Harald Musum <musum@verizonmedia.com> | 2019-03-21 13:08:09 +0100 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2019-03-21 13:08:09 +0100 |
commit | 8d6ad1a22337a8232ce5b6dcd22f817a290fa66c (patch) | |
tree | f5e6dbced3a67f84d0c96957326d3fd5b995f00d /configserver | |
parent | 9c65e8d909c18ec4ad9cecd953fb78549f76b383 (diff) |
Do RPC call asynchronously and with higher timeout
The RPC call is just a hint that the host wants to download the
file reference, no need to wait for call to finish, since we allow
calls to fail. Increase timeout a bit, since we have seen that 100 ms
might not always be enough (e.g. in system tests)
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java index 36d76bbfc79..be82d3950a5 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionImpl.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.config.server.filedistribution; import com.yahoo.cloud.config.ConfigserverConfig; import com.yahoo.config.FileReference; import com.yahoo.config.model.api.FileDistribution; -import com.yahoo.jrt.ErrorCode; import com.yahoo.jrt.Request; import com.yahoo.jrt.Spec; import com.yahoo.jrt.StringArray; @@ -45,14 +44,16 @@ public class FileDistributionImpl implements FileDistribution { // as downloading will then start synchronously when a service requests a file reference instead private void startDownloadingFileReferences(String hostName, int port, Set<FileReference> fileReferences) { Target target = supervisor.connect(new Spec(hostName, port)); - double timeout = 0.1; + double timeout = 0.5; Request request = new Request("filedistribution.setFileReferencesToDownload"); request.parameters().add(new StringArray(fileReferences.stream().map(FileReference::value).toArray(String[]::new))); log.log(LogLevel.DEBUG, "Executing " + request.methodName() + " against " + target.toString()); - target.invokeSync(request, timeout); - if (request.isError() && request.errorCode() != ErrorCode.CONNECTION) { - log.log(LogLevel.DEBUG, request.methodName() + " failed: " + request.errorCode() + " (" + request.errorMessage() + ")"); - } - target.close(); + target.invokeAsync(request, timeout, (req) -> { + if (req.isError()) { + log.log(LogLevel.DEBUG, req.methodName() + " failed: " + req.errorCode() + " (" + req.errorMessage() + ")"); + } + req.target().close(); + }); } + } |