diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-05-19 16:08:36 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-05-19 16:08:36 +0200 |
commit | 008b3de2704cda6fe932a811681cf193a966b1aa (patch) | |
tree | f94c0a30d9852ca8302b49c13e3cc9ae64ff93f3 /vespaclient-container-plugin/src/main | |
parent | 1f9a26d7699ecf65ae85bbb0da424550174aa662 (diff) |
Set message bus message timeout from http request, and 504 on mbus timeout
Diffstat (limited to 'vespaclient-container-plugin/src/main')
-rw-r--r-- | vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java index 1081f654d04..8cb927b8989 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java @@ -479,6 +479,9 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { private DocumentOperationParameters parametersFromRequest(HttpRequest request, String... names) { DocumentOperationParameters parameters = getProperty(request, TRACELEVEL, integerParser).map(parameters()::withTraceLevel) .orElse(parameters()); + parameters = getProperty(request, TIMEOUT, timeoutMillisParser).map(clock.instant()::plusMillis) + .map(parameters::withDeadline) + .orElse(parameters); for (String name : names) switch (name) { case CLUSTER: parameters = getProperty(request, CLUSTER).map(cluster -> resolveCluster(Optional.of(cluster), clusters).name()) @@ -904,6 +907,9 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { case INSUFFICIENT_STORAGE: jsonResponse.commit(Response.Status.INSUFFICIENT_STORAGE); break; + case TIMEOUT: + jsonResponse.commit(Response.Status.GATEWAY_TIMEOUT); + break; default: log.log(WARNING, "Unexpected document API operation outcome '" + response.outcome() + "'"); case ERROR: @@ -1022,6 +1028,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { break; // This is all OK — the latter two are due to mitigating races. case ERROR: case INSUFFICIENT_STORAGE: + case TIMEOUT: onError.accept(operationResponse.getTextMessage()); break; default: |