1
0
Fork 0

use isDirect for slightly different cases (#10560)

* use isDirect for slightly different cases

* comments
This commit is contained in:
Jan 2019-11-28 18:31:04 +01:00 committed by KVS85
parent 9772f35083
commit 0f66d83738
1 changed files with 14 additions and 3 deletions

View File

@ -46,9 +46,20 @@ using namespace arangodb::rest;
RestDocumentHandler::RestDocumentHandler(application_features::ApplicationServer& server,
GeneralRequest* request, GeneralResponse* response)
: RestVocbaseBaseHandler(server, request, response) {
if(request->requestType() == rest::RequestType::POST
&& request->contentLength() <= 1024) {
_allowDirectExecution = true;
if (!ServerState::instance()->isClusterRole()) {
// in the cluster we will have (blocking) communication, so we only
// want the request to be executed directly when we are on a single server.
auto const type = _request->requestType();
if ((type == rest::RequestType::GET ||
type == rest::RequestType::POST ||
type == rest::RequestType::PUT ||
type == rest::RequestType::PATCH ||
type == rest::RequestType::DELETE_REQ) &&
request->contentLength() <= 1024) {
// only allow direct execution if we don't have huge payload
_allowDirectExecution = true;
}
}
}