Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions gui/webgui6/src/TWebCanvas.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,20 @@ class TWebCanvasTimer : public TTimer {
{
fSlow = slow;
fSlowCnt = 0;
SetTime(slow ? 1000 : 10);
SetTime(slow ? 50 : 10);
}

/// used to send control messages to clients
void Timeout() override
{
if (fProcessing || fCanv.fProcessingData) return;
if (fProcessing || fCanv.fProcessingData)
return;
fProcessing = kTRUE;
Bool_t res = fCanv.CheckDataToSend();
fProcessing = kFALSE;
if (res) {
fSlowCnt = 0;
} else if (++fSlowCnt > 10 && !IsSlow()) {
} else if (++fSlowCnt > 100 && !IsSlow()) {
SetSlow(kTRUE);
}
}
Expand Down
38 changes: 2 additions & 36 deletions net/http/src/THttpServer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,47 +40,19 @@
#include <thread>

class THttpTimer : public TTimer {
Long_t fNormalTmout{0};
Bool_t fSlow{kFALSE};
Int_t fSlowCnt{0};

public:
THttpServer &fServer; ///!< server processing requests

/// constructor
THttpTimer(Long_t milliSec, Bool_t mode, THttpServer &serv) : TTimer(milliSec, mode), fNormalTmout(milliSec), fServer(serv) {}
THttpTimer(Long_t milliSec, Bool_t mode, THttpServer &serv) : TTimer(milliSec, mode), fServer(serv) {}

void SetSlow(Bool_t flag)
{
fSlow = flag;
fSlowCnt = 0;
Long_t ms = fNormalTmout;
if (fSlow) {
if (ms < 100)
ms = 500;
else if (ms < 500)
ms = 3000;
else
ms = 10000;
}

SetTime(ms);
}
Bool_t IsSlow() const { return fSlow; }

/// timeout handler
/// used to process http requests in main ROOT thread
void Timeout() override
{
Int_t nprocess = fServer.ProcessRequests();

if (nprocess > 0) {
fSlowCnt = 0;
if (IsSlow())
SetSlow(kFALSE);
} else if (!IsSlow() && (fSlowCnt++ > 10)) {
SetSlow(kTRUE);
}
fServer.ProcessRequests();
}
};

Expand Down Expand Up @@ -656,9 +628,6 @@ Bool_t THttpServer::ExecuteHttp(std::shared_ptr<THttpCallArg> arg)
return kTRUE;
}

if (fTimer && fTimer->IsSlow())
fTimer->SetSlow(kFALSE);

// add call arg to the list
std::unique_lock<std::mutex> lk(fMutex);
arg->fNotifyFlag = kFALSE;
Expand Down Expand Up @@ -1317,9 +1286,6 @@ Bool_t THttpServer::ExecuteWS(std::shared_ptr<THttpCallArg> &arg, Bool_t externa

if (external_thrd && (!handler || !handler->AllowMTProcess())) {

if (fTimer && fTimer->IsSlow())
fTimer->SetSlow(kFALSE);

std::unique_lock<std::mutex> lk(fMutex);
fArgs.push(arg);
// and now wait until request is processed
Expand Down
Loading