From 6452bbbb8ec10f932c7bd9c30f5ef96420986086 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Sun, 16 Nov 2025 14:13:14 +0100 Subject: [PATCH 1/2] [http] remove slow mode for timer Was designed to reduce load on the CPU, but confuse users expecting faster response on http requests --- net/http/src/THttpServer.cxx | 38 ++---------------------------------- 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/net/http/src/THttpServer.cxx b/net/http/src/THttpServer.cxx index e4b5e19af7051..73aaa27490638 100644 --- a/net/http/src/THttpServer.cxx +++ b/net/http/src/THttpServer.cxx @@ -40,47 +40,19 @@ #include 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(); } }; @@ -656,9 +628,6 @@ Bool_t THttpServer::ExecuteHttp(std::shared_ptr arg) return kTRUE; } - if (fTimer && fTimer->IsSlow()) - fTimer->SetSlow(kFALSE); - // add call arg to the list std::unique_lock lk(fMutex); arg->fNotifyFlag = kFALSE; @@ -1317,9 +1286,6 @@ Bool_t THttpServer::ExecuteWS(std::shared_ptr &arg, Bool_t externa if (external_thrd && (!handler || !handler->AllowMTProcess())) { - if (fTimer && fTimer->IsSlow()) - fTimer->SetSlow(kFALSE); - std::unique_lock lk(fMutex); fArgs.push(arg); // and now wait until request is processed From 3e388802eec7e5dfb86f66bf74de7a727a1bf18e Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Sun, 16 Nov 2025 14:15:51 +0100 Subject: [PATCH 2/2] [webcanv] reduce timeout in slow mode 1000 ms is too big --- gui/webgui6/src/TWebCanvas.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gui/webgui6/src/TWebCanvas.cxx b/gui/webgui6/src/TWebCanvas.cxx index e64abb55da212..9585c8e363850 100644 --- a/gui/webgui6/src/TWebCanvas.cxx +++ b/gui/webgui6/src/TWebCanvas.cxx @@ -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); } }