mirror of https://gitee.com/bigwinds/arangodb
Measure time a request takes to get executed by the scheduler (#9224)
This commit is contained in:
parent
c854d04864
commit
da6e9da820
|
@ -455,10 +455,13 @@ bool GeneralCommTask::handleRequestSync(std::shared_ptr<RestHandler> handler) {
|
|||
return false;
|
||||
}
|
||||
|
||||
RequestStatistics::SET_QUEUE_START(handler->statistics(), SchedulerFeature::SCHEDULER->queueStatistics()._queued);
|
||||
|
||||
// queue the operation in the scheduler, and make it eligible for direct execution
|
||||
// only if the current CommTask type allows it (HttpCommTask: yes, VstCommTask: no)
|
||||
// and there is currently only a single client handled by the IoContext
|
||||
bool ok = SchedulerFeature::SCHEDULER->queue(handler->getRequestLane(), [self = shared_from_this(), handler]() {
|
||||
RequestStatistics::SET_QUEUE_END(handler->statistics());
|
||||
auto thisPtr = static_cast<GeneralCommTask*>(self.get());
|
||||
thisPtr->handleRequestDirectly(basics::ConditionalLocking::DoLock, handler);
|
||||
}, allowDirectHandling() && _peer->clients() == 1);
|
||||
|
@ -473,7 +476,7 @@ bool GeneralCommTask::handleRequestSync(std::shared_ptr<RestHandler> handler) {
|
|||
}
|
||||
|
||||
// Just run the handler, could have been called in a different thread
|
||||
void GeneralCommTask::handleRequestDirectly(bool doLock, std::shared_ptr<RestHandler> handler) {
|
||||
void GeneralCommTask::handleRequestDirectly(bool doLock, std::shared_ptr<RestHandler> const& handler) {
|
||||
TRI_ASSERT(doLock || _peer->runningInThisThread());
|
||||
|
||||
if (application_features::ApplicationServer::isStopping()) {
|
||||
|
|
|
@ -156,7 +156,7 @@ class GeneralCommTask : public SocketTask {
|
|||
|
||||
private:
|
||||
bool handleRequestSync(std::shared_ptr<RestHandler>);
|
||||
void handleRequestDirectly(bool doLock, std::shared_ptr<RestHandler>);
|
||||
void handleRequestDirectly(bool doLock, std::shared_ptr<RestHandler> const&);
|
||||
bool handleRequestAsync(std::shared_ptr<RestHandler>, uint64_t* jobId = nullptr);
|
||||
};
|
||||
} // namespace rest
|
||||
|
|
Loading…
Reference in New Issue