mirror of https://gitee.com/bigwinds/arangodb
use isDirect for slightly different cases (#10560)
* use isDirect for slightly different cases * comments
This commit is contained in:
parent
9772f35083
commit
0f66d83738
|
@ -46,11 +46,22 @@ using namespace arangodb::rest;
|
||||||
RestDocumentHandler::RestDocumentHandler(application_features::ApplicationServer& server,
|
RestDocumentHandler::RestDocumentHandler(application_features::ApplicationServer& server,
|
||||||
GeneralRequest* request, GeneralResponse* response)
|
GeneralRequest* request, GeneralResponse* response)
|
||||||
: RestVocbaseBaseHandler(server, request, response) {
|
: RestVocbaseBaseHandler(server, request, response) {
|
||||||
if(request->requestType() == rest::RequestType::POST
|
|
||||||
&& request->contentLength() <= 1024) {
|
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;
|
_allowDirectExecution = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RestDocumentHandler::~RestDocumentHandler() = default;
|
RestDocumentHandler::~RestDocumentHandler() = default;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue